Content Being Echoed Below Footer in Category Post Template
Posted
by poindexter
on Stack Overflow
See other posts from Stack Overflow
or by poindexter
Published on 2010-05-03T20:06:20Z
Indexed on
2010/05/03
20:08 UTC
Read the original article
Hit count: 283
I have created a category template in Wordpress for all posts that are in the 'blog' category. The file name is single-blog.php. There is some conditional code in single.php that checks whether the post is in the 'blog' category and if it is it redirects it to single-blog.php. That seems to be working fine.
The problem is that on all the individual 'blog' categorized posts the post title and content are echoed below the footer of the page. I do not know why they are showing up and I haven't been able to stop it or hide it. The Loop is getting closed on the template page, but I'm wondering if the Loop from single.php is somehow also being sent over. You can view an example of the problem here:
http://69.20.59.228/2010/03/test-blog-post/
Please let me know if you have any suggestions. I am posting two sections of code below. The first is the conditional call in single.php. The second is the code from the single-blog.php (the category post template).
the conditional call in single.php.
<?php
$post = $wp_query->post;
if (in_category('blog')) {
include(TEMPLATEPATH.'/single-blog.php');
}?>
code from the single-blog.php (the category post template)
<?php get_header(); ?>
<?php get_sidebar(); ?>
<p><h2>The IQNavigator Blog</h2></p>
<em><a href="/category/blog">Blog Home</a></em> | <em><a href="/category/blog/feed/">Subscribe via RSS</a></em><p><br></br></p>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
<h1 class="pagetitle"><?php the_title(); ?></h1>
<!-- <p class="details">Posted <?php the_time('l, F jS, Y') ?> at <?php the_time() ?></p> -->
<div class="entry">
<?php the_content('<p class="serif">Read the rest of this entry »</p>'); ?>
<?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
<?php the_tags( '<p>Tags: ', ', ', '</p>'); ?>
<p class="postmetadata alt">
<small>
-----<br>
Posted
<?php /* This is commented, because it requires a little adjusting sometimes.
You'll need to download this plugin, and follow the instructions:
http://binarybonsai.com/wordpress/time-since/ */
/* $entry_datetime = abs(strtotime($post->post_date) - (60*120)); echo time_since($entry_datetime); echo ' ago'; */ ?>
on <?php the_time('l, F jS, Y') ?>,
filed under <?php the_category(', ') ?>.
Follow any responses to this entry through the <?php post_comments_feed_link('RSS'); ?> feed.
<?php if ( comments_open() && pings_open() ) {
// Both Comments and Pings are open ?>
<a href="#respond">Leave your own comment</a>, or <a href="<?php trackback_url(); ?>" rel="trackback">trackback</a> from your own site.
<?php } elseif ( !comments_open() && pings_open() ) {
// Only Pings are Open ?>
Responses are currently closed, but you can <a href="<?php trackback_url(); ?> " rel="trackback">trackback</a> from your own site.
<?php } elseif ( comments_open() && !pings_open() ) {
// Comments are open, Pings are not ?>
You can skip to the end and leave a response. Pinging is currently not allowed.
<?php } elseif ( !comments_open() && !pings_open() ) {
// Neither Comments, nor Pings are open ?>
Both comments and pings are currently closed.
<?php } edit_post_link('Edit this entry','','.'); ?>
</small>
</p>
<?php the_tags( '<p>Tagged: ', ', ', '</p>'); ?>
</div>
</div>
<?php comments_template(); ?>
<?php endwhile; else: ?>
<p>Sorry, no posts matched your criteria.</p>
<?php endif; ?>
<?php get_footer(); ?>
© Stack Overflow or respective owner