How to check for specific category in single.php?
-
Hello. I’m trying to perform a check for a specific category in the single.php page for a single post. I can’t seem to get it to pick up the category properly. I’m attempting to do this with the following code:
<?php if (is_category(‘6’) ): ?>
This is a test
<?php endif; ?>I’ve also tried swapping in the category name instead of the number. No matter what values I use, my text in the IF statement does not appear on the screen. I see some code on that page for displaying the category (“<?php the_category(”) ?>”), but that’s all it does. I need to actually use this in an “if” statement. Any ideas? Thanks!
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘How to check for specific category in single.php?’ is closed to new replies.