In my blog, my "pages" are really just posts sorted by categories. What's the best way to change the way the posts look for one of my category pages?
1 Answer
For styling archive index pages for a given category, target body.category-slug
(where slug
is the category slug) in CSS.
For styling single blog posts that have a given category, assuming your post container is a div, target div.category-slug
(where slug
is the category slug) in CSS.
For PHP operations, you can also use is_category( 'slug' )
, which returns true if you are on the archive index page for a given category, and you can use in_category( 'slug' )
which returns true if the current post is in a given category.