Forums

custom colours for tags/categories (3 posts)

  1. meriadoctookme
    Member
    Posted 3 years ago #

    Hello!

    I have a question regarding my tags and/or category links. I have my tags in a list and would like certain tags to have particular colours. Like, make "blog" tags have a green background and right below, when the "news" tag is used it has a different colour.

    I say tags and/or cats because I'm still deciding hich to list this way. Whichever is easiest, really.

  2. VelvetBlues.com
    Member
    Posted 3 years ago #

    You'd have to create your own loops to display the categories or tags. For tags, for example, you could use get_the_tags();

    See http://codex.wordpress.org/Template_Tags/get_the_tags

    And then when you loop through the tags, you can set up a conditional statement which gives certain tags certain CSS classes.

    For categories, you can do the same with get_the_category();

    See http://codex.wordpress.org/Template_Tags/get_the_category

  3. meriadoctookme
    Member
    Posted 3 years ago #

    Okay, so how would I do that? What conditional statement would work, if I wanted each tag to have a different background colour?

    I don't know much php to be honest.

Topic Closed

This topic has been closed to new replies.

About this Topic