singleX.php using is_single doubling up
-
I’m modifying the default theme (in 1.5.2) to use different single.php for a couple of categories. However, when I view a post in that category, I get the post as expected but under the footer I get this: “Sorry, no posts matched your criteria” and the sidebar repeats (but not the footer).
This only happens on posts, not on Pages, archives, search.
Is there something in single.php I need to remove to get this doubling up taken care of?
My single.php is this:
<?php
$post = $wp_query->post;
if ( in_category('1') ) {
include(TEMPLATEPATH . '/singleone.php'); }
if ( in_category('2') ) {
include(TEMPLATEPATH . '/singletwo.php'); }
else {
include(TEMPLATEPATH . '/singledefault.php');
}
?>And my singleone.php etc have all the same code as the default single.php, slightly altered, i.e.
<div id="content" class="narrowcolumn">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
----snip---
<div class="post" id="post-<?php the_ID(); ?>">
---snip---
<?php comments_template(); ?><?php endwhile; else: ?>
Sorry, no posts matched your criteria.
<?php endif; ?>
</div></div>
<?php include (TEMPLATEPATH . '/sidebarsingle.php'); ?>
<?php get_footer(); ?>
- The topic ‘singleX.php using is_single doubling up’ is closed to new replies.