Changing Font Color by Category (2 posts)

  1. politicolonel
    Posted 4 years ago #

    I'm trying to figure out how to make the content of a specific category appear in a specific color. In this case, I want the content of every category to appear in black (as it currently does) with the exception of two specific categories: one to appear in red and one to appear in blue.

    I am running the most current version of WordPress and my theme is Thesis 1.8

    Thank you for your help

  2. You would need to write a function which uses a conditional to check which category page you are viewing... and then hook the new css style via the function.

    Something like this should work (in your child theme functions.php file):

    if (is_category( array( 'CATEGORY1', 'CATEGORY2' ))) {
       function change_font_color() {
          ?><style type="text/css">YOUR CSS DECLARATIONS</style><?php

    Change "YOUR CSS DECLARATIONS" to include your new font color.

    Change "CATEGORY1" and "CATEGORY2" to the names (or slug names) if the categories you want to check against.

Topic Closed

This topic has been closed to new replies.

About this Topic