Add category classes

I’m using the short code but there are some categories I would like to show in one color and then other categories should show in a different color.


You can use the display_posts_shortcode_post_class filter to customize the classes added to each post.

Here’s how to add a class for each category attached to a post:

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

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.