WordPress.org

Ready to get started?Download WordPress

Forums

different colors for different category names on sidebar (3 posts)

  1. Michael Torbert
    WordPress Virtuoso
    Posted 6 years ago #

    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?

  2. noelgreen
    Member
    Posted 6 years ago #

    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!

  3. Michael Torbert
    WordPress Virtuoso
    Posted 6 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic