[resolved] Different post title color for each category (3 posts)

  1. JuanAcosta1992
    Posted 2 years ago #

    Is there anyway or plugin that works with your theme that will replace the color of the title of each post depending on the category that it is in?

  2. CrouchingBruin
    Posted 2 years ago #

    You don't need a plugin. You can do this just by adding selectors to one of your virtual CSS files.

    If you examine each of your posts using Firebug, you'll notice that each post entry has a class assigned to it like category-category_slug. So you can use that to change the color of your post title. Let's say, for example, that you have a category called Canines and the slug is dogs. All of the posts that have you've marked as Canine will then have the class category-dogs.

    So in your CSS file (I would probably put it at the end of various.css), just add this CSS rule:

    .category-dogs h2 a {
    	color: #f00;

    h2 is used as the post title in the blog page, while h1 is used as the post title in the single post page, so you may want another selector for that as well. Note that this just changes the second half of the title. The first part, which changes color, would need a separate selector if you wanted to change that color, but you can probably figure out how to do that with the tips I've given you above. Just use Firebug to take a look at the elements within the post.

  3. JuanAcosta1992
    Posted 2 years ago #

    Thank you very much

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic