WordPress.org

Support

Support » Plugins and Hacks » different colors for different category names on sidebar

different colors for different category names on sidebar

  • Michael Torbert

    @hallsofmontezuma

    WordPress Virtuoso

    I have many categories (1500+) and have a need to show different ones in different colors on the sidebar. ie, some should be in yellow, blue, red, whatever. Is there some sort of way to add a custom field or designation to them and have the css that controls the color change it?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Just do something like this:

    <div id="category_bg<?php echo rand(1,4); ?>">

    Change “4” to however big you want it to be, then make a series of background color divs in your CSS like so…

    #category_bg1 {
        background: #990000;
    }

    That should do it. They will be random, but you will be able to style all 1500+ with different colors in a few minutes.

    Hope that helps!

    Michael Torbert

    @hallsofmontezuma

    WordPress Virtuoso

    Thanks for your help Noelgreen, but that’s not what I was looking for. I may not have been clear. On the sidebar I’m using the wp-folding-categories plugin, and the name of each category/subcategory will be one of three colors. I want to be able to change what color it is from the admin interface.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘different colors for different category names on sidebar’ is closed to new replies.
Skip to toolbar