WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Pagination on homepage query not working

[Resolved] Pagination on homepage query not working

  • I have this same query and pagination working on the website’s inner pages but when I come to add it to the homepage the pagination doesn’t work. It just shows me the same posts on subsequent pages as it does on the 1st (home) page.

    Any ideas? Here’s my codeā€¦

    <ul id="main" class="clearfix">
    
    <?php /* Start the Loop */
        $my_query = new WP_Query(array(
        	'cat' => '1',
        	'posts_per_page' => 2,
        	'post__not_in' => get_option('sticky_posts'),
        	'paged' => get_query_var('paged')));
        while ( $my_query->have_posts() ) : $my_query->the_post();
    ?>
    
    <li class="grid_3">
    <h2><?php the_title(); ?></h2>
    <?php the_excerpt(); ?>
    </li>
    
    <?php endwhile; /* End the Loop */ ?>
    
    </ul>
    
    <div class="grid_12">
    <?php wp_pagenavi( array( 'query' => $my_query ) ); ?>
    </div>
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] Pagination on homepage query not working’ is closed to new replies.
Skip to toolbar