• daft question i know but can’t seem to find the answer:

    if i’m outside the loop how do i check for category?

    in english what i want is: if the category is number 5, do this…

    thought maybe it was

    if ($page->cat_ID=”5″) {

    but it isn’t, could anyone help out?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Categories are NOT assigned to Pages.

    Please rephrase your question.

    Thread Starter sootylad

    (@sootylad)

    sorry I mean post but that still doesn’t work…

    when i’m on a category page, i want to check if its the category with id 5 thats all…

    so basically something that outside the loop will do this:

    if (the category is category 5) {

    if ( is_category() ) {
    $cat = get_query_var('cat');
    if ($cat == 5) {
    //do cat 5 thingy
    } else {
    // not cat 5 thingy
    }
    }
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Quick one – if a page is a specific category page?’ is closed to new replies.