WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using <?php wp_tag_cloud( $args ); ?> to create a tag in my sidebar. With the "args" you can style it quite a bit, even the different text size, but it doesn't seem to be possible to apply different colors.

What I did is a plain CSS solution which looks somewhat like this:

#tagcloud ul .tag-link-8 {

#tagcloud ul .tag-link-7 {

#tagcloud ul .tag-link-9 {

It works okay, but this is a hassle. I have to apply the colors manually and once I have 50 tags or so this will be kind of ridiculous.

I was wondering if there is a way to connect e.g. the text-size to a specific color (like some tagcloud plugins seem to do anyways) (size:8 = red etc.)?

Anybody any ideas?

Thanks a lot in advance!

share|improve this question
have you searched the plugins? for example wordpress.org/extend/plugins/search.php?q=tag+cloud+color – Michael Oct 1 '11 at 11:54
@Michael: Yes, but maybe I should have mentioned that I do not want to use a plugin! :) – japanworm Oct 1 '11 at 12:06
disect the plugins and extract the respective code and add it into functions.php of your theme. – Michael Oct 1 '11 at 12:44
up vote 2 down vote accepted

Use a filter for the tag cloud to change the inline size declarations to CSS classes and declare the colors in your style sheet:

    color:     #009;
    font-size: .8em;
    color:     #900;
    font-size: 1em;
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.