• Resolved petroica

    (@petroica)


    I’m sure this is something silly I’m missing. I’m building a theme with a static front page whose template also gathers recent posts. Everything works as I would expect, except that when I use query_posts, it won’t display my most recent post. This is what the relevant code looks like. Any hints?

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <div id="mission">
    	<?php the_content(); ?>
    	<?php wp_link_pages(array('before' => 'Pages: ', 'next_or_number' => 'number')); ?>
    	<?php endwhile; endif; ?>
    </div>
    <div id="blog-teaser">
    	<h1>Latest Blog Posts</h1>
    	<?php query_posts('posts_per_page=4'); the_post(); ?>
    	<?php if(have_posts()) : while(have_posts()) : the_post(); ?>
    	<div class="date"><?php the_time('M j'); ?></div><h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
    	<?php endwhile; endif; ?>
    	<?php wp_reset_query(); ?>
    </div>

    Though I ask for 4 posts, I only get 3.
    Homepage vs RSS

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘query_posts won't show latest post?’ is closed to new replies.