So I have created dedicated page template, and on this page I want to list the 3 most recent blog posts, with the usual pagination links to take users to the previous or next 3 posts.
I have the list populated, and the links are appearing, but when I click on either the previous or next links I just get the same 3 posts as before. I can see the URL changes (/blog/page/2) but the posts being shown are always the three most recent ones.
This is the code I am using:
<?php query_posts( array ( 'post_type' => 'post' ) ); if ( have_posts() ) : ?> <?php while ( have_posts() ) : the_post(); ?> <!--post title, description and link--> <?php endwhile; ?> <div class="nav-previous alignleft"><?php next_posts_link( 'Older posts' ); ?></div> <div class="nav-next alignright"><?php previous_posts_link( 'Newer posts' ); ?></div> <?php else : ?> <p><?php _e('Sorry, no posts matched your criteria.'); ?></p> <?php endif; ?>
Can anyone help?
- The topic ‘Pagination not working’ is closed to new replies.