• I’m in the header trying to define the <title> of my pages

    What I’m stumped over is when I define what happens if (is_single())

    I want one title one the single page if the post is in one of the categories 65-71 (all children of category 81)

    and another title if the single post is in any of the other categories

    I really have no idea the best way to do this

    I’m trying something like

    <?php if (is_single()&&in_category(array(’65’,’66’,’67’,’68’)) echo wp_title();
    elseif (is_single()) echo “Title”;

    ?>

    is there are way to store the categories in a variable?

    say if (in_category(array($catgy))) echo “EtcEtcEtc”;

    If someone knows the right way to write this I would appreciate any guidance, I’ve been copying and tweaking all kinds of different things from get_category, single_cat_name, etcetetc

    But I can’t figure out the correct way to write this so WordPress knows what I mean.

    Would love any help

  • The topic ‘store categories in a variable’ is closed to new replies.