• On my archives.php page, I have a section where, depending on the category being viewed, a different set of links is displayed at the bottom.

    As well as links to archives of individual categories, I have one link that displays posts from three different categories.
    https://localhost:8888/wordpress/?cat=13,12,11

    At the moment, when you go to this link, it displays everything in the if statement for category 13, but I don’t want that.

    How would I go about writing an if statement using is_category, that can be used when this multiple archive page is accessed?

Viewing 4 replies - 1 through 4 (of 4 total)
  • At the moment, when you go to this link, it displays everything in the if statement for category 13, but I don’t want that.

    What is it that you do want?

    Thread Starter ctzn_erased

    (@ctzn_erased)

    I want to create a new statement for when ALL THREE categories are accessed in the same archive.

    Categories 11, 12, and 13 have their own subnav absolutely positioned according to which archive you’re viewing.
    When I view the archive for 11, 12 AND 13 together, I don’t want to see 13’s subnav.

    Does that make sense?

    Thread Starter ctzn_erased

    (@ctzn_erased)

    <?php
    if ( is_category(’11’) ) {
    ?>
    <div id=”subnav_one”>
    Content
    </div>

    <?
    } else if ( is_category(’12’) ) {
    ?>
    <div id=”subnav_two”>
    Content
    </div>

    <?
    } else if ( is_category(’13’) ) {
    ?>
    <div id=”subnav_three”>
    Content
    </div>

    <?
    } else if ( is_category(’11 && 12 && 13′) ) {
    ?>
    <div id=”whole_new_subnav”>
    Something totally different.
    </div>

    <?
    } ?>

    It’s the last statement I can’t quite get my head around.
    Perhaps it isn’t even possible.
    Hope this makes sense to you.

    Thread Starter ctzn_erased

    (@ctzn_erased)

    It doesn’t matter – I’ve totally re-thought the site’s structure.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘is_category for multiple categories.’ is closed to new replies.