Forums

How to make this category condition? (8 posts)

  1. tomasi514
    Member
    Posted 2 years ago #

    Here is the page I have:
    http://www.website.com/?page_id=33&category=77

    I want to make a condition on category 77, here is what I am doing:

    if  (is_category('77'))
    {
    }

    or even:

    if  (is_page('33') && (is_category('77')))
    {
    }

    It seams to return false all the time, can someone help me here?

  2. Mark / t31os
    Moderator
    Posted 2 years ago #

    Pages don't have categories.

  3. tomasi514
    Member
    Posted 2 years ago #

    Thanks for help t31, yet we can have such url sometimes, when using plugings like wp ecomm.
    Any answer please?

  4. Mark / t31os
    Moderator
    Posted 2 years ago #

    Shouldn't your URL then be..
    yoursite.com?page_id=33&cat=77

  5. tomasi514
    Member
    Posted 2 years ago #

    All right, no t31, thanks for the remark.
    Categories seam not to be the same in wp eCommerce.

    Can anyone help here please?

  6. vtxyzzy
    Member
    Posted 2 years ago #

    I think what you want is:

    if  ( isset($_GET['category']) && (77 == $_GET['category']) )
    {
    }
  7. vtxyzzy
    Member
    Posted 2 years ago #

    See my previous reply.

  8. tomasi514
    Member
    Posted 2 years ago #

    Works just fine!
    Thanks a lot vtxyzzy!

Topic Closed

This topic has been closed to new replies.

About this Topic