Styling different categories (1 post)

  1. viktorrichardson
    Posted 8 years ago #


    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:
    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?

Topic Closed

This topic has been closed to new replies.

About this Topic

  • RSS feed for this topic
  • Started 8 years ago by viktorrichardson
  • This topic is not resolved
  • WordPress version: 2.3