I have a certain category of posts (let's say the category is
punk-rockers) that I would like to:
- be styled differently from other posts in my main loop (index.php) and
- have single posts (single.php) which are styled differently from my other posts.
So, there will be four different styles, in total:
- default loop
- special-category loop (e.g.
- default single post
- special-category single post (e.g.
Importantly, styles #2 and #4 are also not only different from #1 and #3, but also from each other. So not only will posts of category
punk-rockers look different on the main loop from the other posts, but these posts will also have single-posts whose own styling will differ, depending on if it appears in the main-loop or single post.
I know I can use the existing category class
.category-punk-rockers to modify the posts of this category in CSS, but here is my problem: I'm not sure how about the easiest way to stylize them differently on the loop and the single.
I would love it if you all could tell me what you think are the most elegant selectors to use/approach to take to accomplish this.
Note: answers to this question use php to solve some of a somewhat similar issue with content differing (as opposed to just style), but I think if I only want to change style there might be a simpler, CSS-only approach I can use.