WordPress.org

Support

Support » How-To and Troubleshooting » Changing Font Color by Category

Changing Font Color by Category

  • politicolonel
    Member

    @politicolonel

    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

Viewing 1 replies (of 1 total)
  • Josh
    Participant

    @josh401

    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
       }
       add_action('wp_head','change_font_color');
    }

    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.

Viewing 1 replies (of 1 total)
  • The topic ‘Changing Font Color by Category’ is closed to new replies.