Support » How-To and Troubleshooting » Category specific coloring?

Category specific coloring?

  • This seems like a simple thing to do, but I can’t get it figured out. I would like the title color of posts be dependent on which category they are in.

    For example, post 1 is in category a; so the title should be green. Post 2 is in category b, so the title color should be red.
    Is this possible? What am I missing here? Thanks!

Viewing 13 replies - 1 through 13 (of 13 total)
  • Moderator Michael


    try and use post_class() in the div of your posts:

    have you checked – your theme might already be using it?

    Well I *kinda* got it working. But not really. How do I specify that only the title be a certain color? I got it so that the brief description text is colored. But that’s not quite what I had in mind.


    Moderator Michael


    try and use more specific css styles, such as:

    .category-stingers .entry-title a:link { color:green; }
    /*optional the hover state*/
    .category-stingers .entry-title a:hover { color:blue; }

    (you need to style the link, as it would otherwise be overwritten by the other styles for links)

    Thanks, I tried your links (I had everything but the a:link part), but it still will not work for me. Any other ideas on how to get this to work??

    Moderator Michael


    refresh your browser cache by pressing the ‘reload’ button; or by pressing ‘ctrl’ nad ‘f5’ simultanoulsy.

    I’ve tried that. I opened the page in Firefox and I do see the colors. However, Chrome and IE won’t though. And FF only shows it on the main page and nowhere else. Any suggestions on how to make it more universal and compatible with all the browsers?

    Moderator Michael


    try without the :link bit; for instance:

    .category-stingers .entry-title a { color:green; }

    i assume, otherwise the styles get owerwritten by some a:visited style.

    or build :hover and :visited styles for your colored titles: http://wap.w3schools.com/css/css_pseudo_classes.asp

    Ah, that got it!

    Again though…kinda. Still not showing up on the category pages that I created. I’m using azindex for the pages…still gotta figure that out. Ug.

    Thanks for your help so far, I really appreciate it!

    Moderator Michael


    i get the coloring in the category archive pages as well –

    i assume, your browser caches are holding on to old stuff quite well.

    I guess! Something is going on. I checked with Chrome, FF and IE and none of them show coloring on any category pages. I’ll have to check at work to see what it look likes there.

    Thanks for all of your help!

    Wait, I just figured out what you were talking about. Yes, I see the coloring if I click on the category links on the left side of the page. But if you click on the top links, the colors don’t know. That’s the next thing I need to fix.

    Moderator Michael


    i was focussing only on the post titles.

    the cetegory menu in the sidebar has css classes for .cat-item-8 etc, where the number is the category id.

    because these are links as well, you need to style .cat-item-8 a etc.

    the top menu has individual css classes with ids, but unrelated to any category id:

    for instance .menu-item-208 for the ‘stingers’ tab.

    you can find these when you look into the html code of your site in your browser (‘view source’ or similar)

    Sorry, I’m still struggling to figure this out. If I click on the top menu stingers, everything that is on that page doesn’t have the green color. Which isn’t a huge deal I guess, because the word is right there. So people will know by looking at the title.

    But if someone clicks on movies, then how can I set it up so that the title are the proper color? There will be a mixture of different categories that they will belong to. So even if I configure the css for everything under movies to have a certain color, that would be wrong. I need it to recognize which categories each page is under and color the titles accordingly.

    Sorry, I’m not a noob at web development and wordpress, but I obviously still have a long way to go before I can figure this sort of stuff out on my own.

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Category specific coloring?’ is closed to new replies.