Filters

Filters allow you to modify how Display Posts works using code. You should place your customizations in a core functionality plugin or use Code Snippets.

display_posts_shortcode_args
9 tutorials using this filter
Customize the query arguments passed to WP_Query.

display_posts_shortcode_author
1 tutorial using this filter
Filter the HTML markup for the author if [[display-posts include_author="true"]]

display_posts_shortcode_category_display
1 tutorial using this filter
Customize the HTML markup for the category listing if [[display-posts category_display="true"]]

display_posts_shortcode_inception_override
1 tutorial using this filter
When displaying the full content (include_content="true"), we disable any Display Posts listings within that content from running to prevent infinite loops. If you are SURE you won't get an infinite loop and want the shortcode to run, use this filter to override it.

display_posts_shortcode_no_results
1 tutorial using this filter
Customize the message displayed if no posts are found. The default is empty, but you can specify one in shortcode with [[display-posts no_posts_message="message goes here"]]

display_posts_shortcode_output
13 tutorials using this filter
The output filter lets you add, edit, remove, and re-order the elements that make up each post listing. More information.

display_posts_shortcode_post_class
2 tutorials using this filter
Add or modify the CSS classes on the individual posts in the listing.

display_posts_shortcode_sanitized_segments
No tutorials yet for this filter
Filter the sanitize segments for the given date or time string, for date queries.

display_posts_shortcode_title_tag
1 tutorial using this filter
Modify what heading tag is used for display posts title if [[display-posts title="Recent Posts"]]. The default is h2.

display_posts_shortcode_wrapper_close
3 tutorials using this filter
Customize the outer closing markup for the entire listing. By default it is ul but can be changed to ol or div using the 'wrapper' attribute. Use this filter to change it to any HTML element.

display_posts_shortcode_wrapper_open
5 tutorials using this filter
Customize the outer opening markup for the entire listing. By default it is ul but can be changed to ol or div using the 'wrapper' attribute. Use this filter to change it to any HTML element.

do_shortcode_tag
1 tutorial using this filter
Modify the entire shortcode output right before it is rendered. Note that this filter applies to every shortcode (not just Display Posts). The second parameter is the shortcode $tag which will be 'display-posts' when modifying the Display Posts shortcode.

pre_display_posts_shortcode_output
2 tutorials using this filter
This is the first filter to run in Display Posts, before the attributes are setup and before the query runs. Use this to prevent the shortcode from running or return a cached copy of the shortcode output.

shortcode_atts_display-posts
3 tutorials using this filter
Change the default arguments of the shortcode. For instance, if you want all shortcodes to have include_excerpt="true" and include_author="true", you could use this to set it once and then not have to include those parameters on all shortcodes.