I am using body_class();
to style different sections of a wordpress site by their body class. Page styles descend from .page-template
, blog styles descend from .single-post
and/or .blog
etc.
I have created a custom post type “Products” for the products section of the site and want to style this section specifically using it’s body class, but unfortunately body_class();
is also giving the custom post type single pages the class .blog
which is making many of the blog styles override the product styles- very frustrating.
Is there a way to take the “blog” class away for my custom post type single pages?
Thanks!
You can use
body_class
filter to check if you are on your custom post type, and if so then just remove theblog
class like this:Hope this helps