Post Link
elementor_extras/widgets/posts/link
Filters the post link.
Parameters
Param | Type | Description |
---|---|---|
$link | String | The link to the post |
$post | WP_Post | The post object |
Example usage
add_filter( 'elementor_extras/widgets/posts/link', function( $link, $post ) { // Modify post link here return $link; // Return the post link }, 10, 2);
Post Thumbnail
elementor_extras/widgets/posts/thumbnail
Filters the post thumbnail.
Parameters
Param | Type | Description |
---|---|---|
$post_thumbnail | String | The html for the thumbnail of the post |
$post | WP_Post | The post object |
Returns
post_thumbnail — The html for the thumbnail of the post.
Example usage
add_filter( 'elementor_extras/widgets/posts/thumbnail', function( $post_thumbnail, $post ) { // Modify post thumbnail html here return $post_thumbnail; // Return the post thumbnail }, 10, 2);
Post Title
ee_posts_title
Deprecated. Use elementor_extras/widgets/posts/title instead.
elementor_extras/widgets/posts/title
Filters the title of each post in the widget.
Parameters
Param | Type | Description |
---|---|---|
$post_title | String | The title of the post |
$post | WP_Post | The post object |
Returns
post_title — The title of the post
Example usage
add_filter( 'elementor_extras/widgets/posts/title', function( $post_title, $post ) { // Modify post title here return $post_title; // Return the post title }, 10, 2);
elementor_extras/widgets/posts/title/link
Filters the title link of each post in the widget.
Parameters
Param | Type | Description |
---|---|---|
$title_link | String | The link to the post |
$post | WP_Post | The post object |
Returns
title_link — The link to the post
Example usage
add_filter( 'elementor_extras/widgets/posts/title/link', function( $title_link, $post ) { // Modify the link here return $title_link; // Return the link }, 10, 2);
Post Date Time
ee_posts_date_time
Deprecated. Use elementor_extras/widgets/posts/date_time instead.
elementor_extras/widgets/posts/date_time
Filters the date of each post in the widget.
Parameters
Param | Type | Description |
---|---|---|
$post_date_time | String | The date and time of the post |
$post | WP_Post | The post object |
Returns
post_title — The title of the post
Example usage
add_filter( 'elementor_extras/widgets/posts/post_date_time', function( $post_date_time, $post ) { // Modify date time here return $post_date_time; // Return the date time }, 10, 2);
Post Comments
ee_posts_comments_prefix
Deprecated. Use elementor_extras/widgets/posts/comments/prefix instead.
elementor_extras/widgets/posts/comments/prefix
Filters the prefix for the post comments count.
Parameters
Param | Type | Description |
---|---|---|
$post_comments_prefix | String | The comments count prefix |
$post | WP_Post | The post object |
Returns
post_comments_prefix — The comments count prefix
Example usage
add_filter( 'elementor_extras/widgets/posts/comments/prefix', function( $post_comments_prefix, $post ) { $post_comments_prefix = __( 'Comments: ' ); return $post_comments_prefix; // Return the comments count prefix }, 10, 2);
In the example above we change the prefix with a custom one programatically.
ee_posts_comments
Deprecated. Use elementor_extras/widgets/posts/comments instead.
elementor_extras/widgets/posts/comments
Filters the post comments count.
Parameters
Param | Type | Description |
---|---|---|
$post_comments | String | The comments count |
$post | WP_Post | The post object |
Returns
post_comments — The comments count
Example usage
add_filter( 'elementor_extras/widgets/posts/comments', function( $post_comments, $post ) { if ( 0 === get_comments_number( $post->ID ) ) { // Check if there are any comments $post_comments = __( 'No comments' ); // Replace the count with a custom string } return $post_comments; // Return the post comment count }, 10, 2);
In the example above we replace the comment count to a specific message if there are no comments for the post.
ee_posts_comments_suffix
Deprecated. Use elementor_extras/widgets/posts/comments/suffix instead.
elementor_extras/widgets/posts/comments/suffix
Filters the suffix for the post comments count.
Parameters
Param | Type | Description |
---|---|---|
$post_comments_suffix | String | The comments count suffix |
$post | WP_Post | The post object |
Returns
post_comments_suffix — The comments count suffix
Example usage
add_filter( 'elementor_extras/widgets/posts/comments/suffix', function( $post_comments_suffix, $post ) { $post_comments_suffix = __( 'replies' ); return $post_comments_suffix; // Return the comments count suffix }, 10, 2);
The example above sets the suffix to ‘replies’. The output for the comment count (if no prefix is added) will be:
10 replies
Post Excerpt
ee_posts_excerpt
Deprecated. Use elementor_extras/widgets/posts/excerpt instead.
elementor_extras/widgets/posts/excerpt
Filters the post excerpt.
Parameters
Param | Type | Description |
---|---|---|
$post_excerpt | String | The excerpt of the post |
$post | WP_Post | The post object |
Returns
post_excerpt — The excerpt of the post
Example usage
add_filter( 'elementor_extras/widgets/posts/excerpt', function( $post_excerpt, $post ) { // Modify post excerpt here return $post_excerpt; // Return the excerpt }, 10, 2);
In the above example we hook into the field excerpt, check if a specific ACF field is set and if so we set the excerpt of the value of that field.
Post Button
elementor_extras/widgets/posts/media/link
Filters the post media link. This is available only if the whole media area is linked when the Content > Media > Link to Post option is enabled.
Parameters
Param | Type | Description |
---|---|---|
$media_link | String | The link for the post media area |
$post | WP_Post | The post object |
Returns
media_link — The link for the media area
Example usage
add_filter( 'elementor_extras/widgets/posts/media/link', function( $media_link, $post ) { // Modify the link here return $media_link; // Return the link }, 10, 2);
Post Button
elementor_extras/widgets/posts/button/link
Filters the post button link.
Parameters
Param | Type | Description |
---|---|---|
$button_link | String | The link for the post button |
$post | WP_Post | The post object |
Returns
button_link — The link for the button
Example usage
add_filter( 'elementor_extras/widgets/posts/button/link', function( $button_link, $post ) { // Modify the link here return $button_link; // Return the link }, 10, 2);
elementor_extras/widgets/posts/button/text
Filters the label for the post read more button.
Parameters
Param | Type | Description |
---|---|---|
$button_text | String | The label of the button |
$post | WP_Post | The post object |
Returns
button_text — The button label
Example usage
add_filter( 'elementor_extras/widgets/posts/button/text', function( $button_text, $post ) { $button_text = sprintf( __( 'Read about %s' ), $post->post_title ); // Include the post title in the button label return $button_text; // Return the button label }, 10, 2);
In this example we redefine the label for the button include the title of the post and return the new label.
Queries
elementor_extras/widgets/posts/query
Filters the current query for the widget. This is run AFTER any Elementor filters added for the same query.
Parameters
Param | Type | Description |
---|---|---|
$query | WP_Query | The current query |
Returns
query — The modified query
Example usage
add_filter( 'elementor_extras/widgets/posts/query', function( $query ) { // Modify your query here return $query; // Return the new query }, 10, 1);
Using the Query ID feature — This filter does not use the Query ID feature provided in the widget settings and it applies to all instances of the Posts Extra widget. To use the Query ID feature you need to use the same method used for the Query ID feature in Elementor Pro’s Posts widget. It works identically.
elementor_extras/widgets/posts/filters/args
Coming soon
Filters the args for the term filters.
Parameters
Param | Type | Description |
---|---|---|
$args | Array | Array of arguments. See WP_Term_Query::__construct() for information on accepted arguments. |
Returns
$args — The modified args
Example usage
add_filter( 'elementor_extras/widgets/posts/filters/args', function( $args ) { $args['hide_empty'] = false; return $args; }, 10, 1);
Classes
elementor_extras/widgets/posts/item_classes
Filters the classes for the item wrapper. The item wrapper wraps the post.
Parameters
Param | Type | Description |
---|---|---|
$classes | Array | Classes to filter. |
$post | WP_Post | The current post object. |
$settings | Array | The widget settings. |
Returns
$classes — The filtered array of classes.
Example usage
add_filter( 'elementor_extras/widgets/posts/item_classes', function( $classes, $post, $settings ) { $classes[] = 'my-new-class'; return $classes; }, 10, 3);
elementor_extras/widgets/posts/post_classes
Filters the classes for the post wrapper. The post wrapper wraps all the content of the post.
Parameters
Param | Type | Description |
---|---|---|
$classes | Array | Classes to filter. |
$post | WP_Post | The current post object. |
$settings | Array | The widget settings. |
Returns
$classes — The filtered array of classes.
Example usage
add_filter( 'elementor_extras/widgets/posts/post_classes', function( $classes, $post, $settings ) { $classes[] = 'my-new-post-class'; return $classes; }, 10, 3);