On my site I add the categories to the post div classes:
<div class="post<?php
// add classes for categories
foreach ((get_the_category()) as $category) {
echo ' ' . $category->category_nicename;
}
?>" id="post-<?php the_ID(); ?>">
category-nicename
gives the category slugs, so by default a ‘review pages’ category would be ‘review-pages’, for example.
Say you have a category called ‘reviews’, make sure .reviews { }
is below everything else in the CSS, so it overrides the settings above.
This won’t replace the CSS of standard posts, but you can reset it all, e.g. if posts have margin: 1em
then do margin: 0
to get rid of it in .reviews
.
If you have a separate CSS file, you could use @import
at the bottom of style.css to add it on. If you don’t want to add the category classes to the separate CSS file, you could use some PHP to do the @import only on the pages with that category.