0

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 1

1

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.

1
  • Cool! Just what I was looking for.
    – Dan
    Commented Jun 22, 2011 at 14:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.