WordPress.org

Ready to get started?Download WordPress

Forums

Page and Single Post Templates displaying recent posts instead of content (4 posts)

  1. soonermike
    Member
    Posted 4 years ago #

    I've got a custom-made theme for my personal site (http://www.mikemorkes.com). 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: ?>
    
    	<h2>Woops...</h2>
    
    	<p>Sorry, no posts were found.</p>
    
    	<?php endif; ?>
    
    </div>
    
    <?php get_footer(); ?>
  2. soonermike
    Member
    Posted 4 years ago #

    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.

  3. soonermike
    Member
    Posted 4 years ago #

    Bump.

  4. henkholland
    Member
    Posted 4 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic