I’m having what seems like a fairly common problem, however I can’t resolve my issue with the advise in other resolved threads.
I have a blog-homepage template that is set to display 5 posts. When I click the ‘older entries’ link (or ‘newer entries’) the returned page/2, page/3, etc, displays the same 5 most recent posts.
Here is everything between my div that holds the post’s content and the footer:
<?php query_posts("posts_per_page=5"); ?> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div <?php post_class() ?> id="post-<?php the_ID(); ?>"> <h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2> <?php include (TEMPLATEPATH . '/inc/meta.php' ); ?> <div class="entry"> <?php the_content(); ?> </div> <div class="postmetadata"> <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?> </div> </div> <?php endwhile; ?> <?php include (TEMPLATEPATH . '/inc/nav.php' ); ?> <?php else : ?> <h2>Not Found</h2> <?php endif; ?>
I have also tried disabling all plug-ins to test for compatibility.
Any hints would be fantastic. Thank you!
You must include the ‘paged’ argument to query_posts in order for pagination to work. Try changing this:
<?php query_posts("posts_per_page=5"); ?>
<?php $paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1; query_posts("posts_per_page=5&paged=$paged"); ?>
THANKS! That’ll do it. I appreciate the help. Now I’m going to look up why that works so I don’t forget to do that in the future.
- The topic ‘Problem with 'Older Entries" link.’ is closed to new replies.