Pagination resolving to first page only

My pagination is only linking to the same posts that are on my front page.

I have 3 posts on my front page, when I press next it goes to /page/2 but only shows the same 3 posts, with no previous button. The next button is still there, but still goes to page/1

Read More

Here is the full query.

<?php

            query_posts('post_type=post&posts_per_page=3');

            if ( have_posts() ) : while ( have_posts() ) : the_post();

            $category = choose_one_category(get_the_category());

            switch ($category){
                case "Festival News":
                    $left[] = $post;
                    break;
                case "Industry News":
                    $centre[] = $post;
                    break;
                case "Other":
                    $right[] = $post;
                    break;
            }


            endwhile; 
            ?>
            <div class="custom-pagination">

            <div ><?php previous_posts_link('&laquo; Previous') ?></div>

            <div ><?php next_posts_link('Next &raquo;') ?></div>
            </div>
            <?php endif;



            ?>

Related posts

Leave a Reply

4 comments

  1. Building off of what Rarst has said, I’m pretty sure the query string will retain ‘paged’ queries even if WP_Query strips it out as irrelevant. You could try replacing your query posts line with this:

    global $query_string;
    parse_str( $query_string, $my_query_array );
    $paged = ( isset( $my_query_array['paged'] ) && !empty( $my_query_array['paged'] ) ) ? $my_query_array['paged'] : 1;
    query_posts('post_type=post&posts_per_page=3&paged='.$paged);
    
  2. Pagination functions are meant to be used with main Loop. They are relying on global variables $paged and $wp_query, which are not set by your custom loop.