in_category not working
-
Using WP 2.5 and trying to deliver a different page if the single post being clicked on is in a specific category, else deliver the standard single page.
This code came directly from the Codex and modified only to use my actual category ID and include file
<?php $post = $wp_query->post; if (in_category(16)) { include(TEMPLATEPATH . '/single-cat-16.php'); } else { include(TEMPLATEPATH . '/single.php'); } ?>
However, even though I am positive that a post is within the category specified (16) – I even checked it using phpMyAdmin to be certain – WP is still using single.php, not single-cat-16.php for all single posts.
In searching through the Codex and forums I came across information that said to use “is_category” instead of “in_category” if you are not using it within the Loop, so I tried that as well – made no difference.
Is there something different about 2.5 and this function?
- The topic ‘in_category not working’ is closed to new replies.