Forums

is_category conditional not working - my code? (2 posts)

  1. richarduk
    Member
    Posted 1 year ago #

    The following code is pasted into a category-7.php template

    <?php if (is_category('7')) {
    echo 'test';
    }
    ?>
    
    <?php echo 'yes';?>

    I'm not managing to get the first bit of code to work, though the second displays ok.

    Is there anything obvious that I'm doing wrong?

  2. tnerb
    Member
    Posted 1 year ago #

    Hi richarduk. I'm no php expert but since it's so difficult to get an answer on these forums, I'll throw in my 2 cents. Your code snippet worked fine for me.

    You did make sure that you have a category that actually has a numerical id of "7", correct?

Topic Closed

This topic has been closed to new replies.

About this Topic