WordPress.org

Ready to get started?Download WordPress

Forums

Pagination not working (1 post)

  1. KS Web Designer
    Member
    Posted 11 months ago #

    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?

Reply

You must log in to post.

About this Topic

  • RSS feed for this topic
  • Started 11 months ago by KS Web Designer
  • This topic is not resolved
  • WordPress version: 3.6