Using in_category to to show or hide data
-
I’m working from the twenty ten theme and have this code to return the date if the post belongs to a category and return nothing if it doesn’t (in this case, if it’s a custom post type, it won’t return the date).
<?php if ( in_category('') ) : ?> <div class="entry-meta"> <?php twentyten_posted_on(); ?> </div><!-- .entry-meta --> <?php else: ?> <?php endif ?>
It works fine if I enter the name of a given category, but I don’t want to have to manage this code every time I add a new category. Is there something I can add that globally accepts all categories? Haven’t been able to find that answer anywhere.
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Using in_category to to show or hide data’ is closed to new replies.