Support » Fixing WordPress » Page and Single Post Templates displaying recent posts instead of content

  • soonermike


    I’ve got a custom-made theme for my personal site ( The HTML all validates (except one line that comes directly from Twitter). The home page displays correctly – it lists recent posts. However, all pages and single posts display the same listing of recent posts instead of the content that should be there. For instance, ideally, the About page would have a little bio info about me, which I typed in via the admin Pages panel – instead, I get recent posts. I tried commenting out extraneous code from the header, but that didn’t fix it. Switching to a different theme fixes the problem, so it can’t be a corrupt database. It’s like something in my code is breaking the wordpress loop. Any ideas? Here’s the code from page.php:

    <?php get_header(); ?>
    <!-- start of page php -->
    <div id="content">
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    	<div class="post"><h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
    	<?php the_content(); ?><br />
    	<p><?php the_time('F j, Y'); ?> at <?php the_time('g:i a'); ?> | <?php the_category(', '); ?> | <?php comments_number('No comment', '1 comment', '% comments'); ?></p></div><br />
    	<?php endwhile; else: ?>
    	<p>Sorry, no posts were found.</p>
    	<?php endif; ?>
    <?php get_footer(); ?>

Viewing 3 replies - 1 through 3 (of 3 total)
  • soonermike


    Forgot to mention that I “tricked” WP into displaying my resume by hardcoding it into a new template reserved only for that page – more a cheat than a fix, really.






    Hi Soonermike, try changing back to the default theme and see what happens.
    Could not find anything strange and your code looks fine.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Page and Single Post Templates displaying recent posts instead of content’ is closed to new replies.