Problem with pagination in WordPress custom template

I created a new template in WordPress to show the latest articles. After, I will sort them in other ways. My problem is I can not use the pagination correctly.

The next page and previous page are working ok, but the posts are not changed. The first three are the only that are shown.

Read More

Can you give me a clue about this ?

<?php
/*
Template Name: Latest Prizes
*/
get_header(); 


// The Query
query_posts( 'posts_per_page=3' );

// The Loop
while ( have_posts() ) : the_post();
    echo '<li>';
    the_title();
    echo '</li>';
endwhile;

posts_nav_link(' · ', 'previous page', 'next page');


// Reset Query
wp_reset_query();


get_footer(); ?>

Related posts

Leave a Reply

1 comment

  1. From the WordPress Codex on query_posts():

    For example, on the homepage, you would normally see the latest 10 posts. If you want to show only 5 posts (and don’t care about pagination), you can use query_posts() like so:

    query_posts( 'posts_per_page=5' );

    Change your query_posts() to this:

    query_posts(array('posts_per_page' => 3, 'paged' => get_query_var('page')));