List posts in the current category

Display Posts lets you limit posts to a certain category with the category parameter.

[display-posts category="tutorials"]

But what if you’d like to show other posts in the current post’s category without having to type it out each time. This is especially useful in widgets and sidebars since you can add the shortcode once and it will automatically update to show content related to the current post.

I recommend you also use the exclude_current="true" parameter so the current post is not included in the listing.

[display-posts taxonomy="category" tax_term="current" exclude_current="true"]

You can do the same thing with tags too.

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 *