Support » Fixing WordPress » is_category() conditional not working on archive.php

  • perthmetro

    (@perthmetro)


    I’m not sure why this is not working outside the loop on my archive.php page?

    <?php if (is_category('7')) { ?>
    <p>dfgdfgdfgdf</p>
    <?php } elseif (is_category('6')) { ?>
    <p>gdgdfgfdgdf</p>
    <?php } elseif (is_category('999999')) { ?>
    <p>Show something different!</p>
    <?php else { ?>
    <?php } ?>
Viewing 1 replies (of 1 total)
  • perthmetro

    (@perthmetro)

    Worked it out

    <?php if ( is_category(7) ) { ?>
    <p>ggdfgfdgdfg</p>
    <?php } elseif ( is_category(6) ){ ?>
    <p>fdgdfgfdgfdgfd</p>
    <?php } else { ?>
    <?php } ?>
Viewing 1 replies (of 1 total)
  • The topic ‘is_category() conditional not working on archive.php’ is closed to new replies.