• viktorrichardson

    (@viktorrichardson)


    Hi,

    I want to have a different background-color on my post depending on what category it is.
    What I need is a variable or funtcion that returns either the catergory ID or the category name of each post. For example the “the_ID()” function returns the post-ID.

    I want to make something like this:
    <?php
    if( the_category_ID() == 2 ) {
    echo “<div class=’blue’>”
    }
    ?>

    …or something like that ??
    This doesn’t work because there is no the_category_ID()-function. Is there a function (or maybe a variable) that i can use?

  • The topic ‘Styling different categories’ is closed to new replies.