I’ve inherited a theme from a another developer that I’ve re-styled for a client. We’re just about finished, but I thought I’d run it through the Theme-Check plug-in to see if there’s any errors or problems.
Unfortunately there’s a ton. I’ve gotten rid of most of them, but I have one Required left:
REQUIRED: Could not find post_class. See: post_class
I’ve read the WP page on post_class, but as a relative newcomer I still don’t understand what it is, or why it should be required.
What should I do to fix this?
What it does
post_class
adds classes to the posts on a post by post basis, usually adding them to some kind of post “wrapper”. This allows for the targeting of posts with CSS rules according to various criteria– category, tag, sticky, format, etc. That is, theme authors, plugin authors, and individual users can write CSS rules based on the classes added bypost_class
and get very fine grained control over layout.Why you want it
While I am not a canonical source, I am sure it is required according to the WordPress Theme guidelines to ensure a minimal functionality across themes. If you aren’t submitting your theme to the WordPress repo you can do what you want. There are no WordPress Theme Police to track you down and spank you, but
post_class
and the relatedbody_class
are very useful and easy to implement. I see no reason not to use them.