Pagination content not changing using WP_Query
-
I really hope that someone can help me with this as I’ve been searching for hours and it’s driving me nuts..
I am trying to limit the number of posts using WP_Query, this is my code
<?php $paged = (get_query_var('page')) ? get_query_var('page') : 1; $args = array('posts_per_page' => '2' , 'page' => $paged ); $wp_query = new WP_Query($args); ?> <?php if ($wp_query->have_posts()) : while ($wp_query->have_posts()) : $wp_query->the_post(); ?> /// stuff in the loop <?php endwhile; ?> <?php if ( function_exists( 'bones_page_navi' ) ) { ?> <?php bones_page_navi(); ?> <?php } else { ?> <nav class="wp-prev-next"> <ul class="clearfix"> <li class="prev-link"><?php next_posts_link( __( '« Older Entries', 'bonestheme' )) ?></li> <li class="next-link"><?php previous_posts_link( __( 'Newer Entries »', 'bonestheme' )) ?></li> </ul> </nav> <?php } ?> <?php wp_reset_postdata(); ?> <?php else : ?>
The pagination links show fine but when I click them the content doesn’t change. The URL is correct, however. I have changed the reading settings max posts to 2 but still get the same problem.
Any help would be greatly appreciated.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Pagination content not changing using WP_Query’ is closed to new replies.