WordPress.org

Ready to get started?Download WordPress

Forums

how do I use the "category ID" variable in a conditional? (2 posts)

  1. poopers
    Member
    Posted 7 years ago #

    I'm looking to put a conditional argument on my index.php that'd look something like this:

    if $categoryid = 1 {
    echo post template #1;
    }
    if $categoryid = 2 {
    echo post template #2;
    }

    et cetera. My problem is: I don't know what the variable for category id is. I've tried many different variable names; perhaps I simply don't know how to globalize it. I've been trying things like $variable and $post['variable'] and nothing will parse. Any insight into this matter will be greatly appreciated.

  2. MichaelH
    Member
    Posted 7 years ago #

    You mean something like in_category?

    Also see:
    Conditional_Tags

Topic Closed

This topic has been closed to new replies.

About this Topic