WordPress.org

Ready to get started?Download WordPress

Forums

is_category() conditional not working on archive.php (2 posts)

  1. Pete
    Member
    Posted 2 years ago #

    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 } ?>
  2. Pete
    Member
    Posted 2 years ago #

    Worked it out

    <?php if ( is_category(7) ) { ?>
    <p>ggdfgfdgdfg</p>
    <?php } elseif ( is_category(6) ){ ?>
    <p>fdgdfgfdgfdgfd</p>
    <?php } else { ?>
    <?php } ?>

Topic Closed

This topic has been closed to new replies.

About this Topic