/ Published in: PHP
For use on a single page... Only displays the content if the displayed post is in the specified category. You can use the category slug or the category ID if you know it.
Expand |
Embed | Plain Text
<?php if (in_category('events')) : ?> <div class='eventinfo'> <h2>Event Details</h2> <?php the_meta(); ?> </div> <?php endif; ?>
Comments
Subscribe to comments
You need to login to post a comment.

Thanks! Very useful.
Great but.. what if i want the condition to include all categories ? Meaning to check if i am in a category "page"
Great but.. what if i want the condition to include all categories ? Meaning to check if i am in a category "page"