Include the post categories in the listing

Display Posts can include a list of terms associated with each post in the listing. These can be categories, tags, or any custom taxonomy.

If you set category_display="true" it will include a listing of the categories. You can also list tags ( category_display="post_tag") or any custom taxonomy ( category_display="taxonomy_name").

Here’s an example from this site. I use a taxonomy called “dps_filter” to categorize tutorials based on what filter they use.

Shortcode

[display-posts category_display="dps_filter" category_label="Filters used: "]

Result

Removing category links

If you don’t want the category names to be clickable to their archive pages, use the following code:

This code snippet goes in a core functionality plugin or Code Snippets.

// Remove category links
add_filter( 'display_posts_shortcode_category_display', 'strip_tags' );

Filters used:

Published by Bill Erickson

Bill Erickson is a freelance WordPress developer and a contributor to the Genesis framework. For the past 14 years he has worked with attorneys, publishers, corporations, and non-profits, building custom websites tailored to their needs and goals.

Leave a comment

Your email address will not be published. Required fields are marked *