Loop with pagination only showing two pages
-
Hi. I’ve created a loop with pagination, to show three posts per page. The pagination is only showing two pages of posts, whereas it should be showing four, as there are 11 posts altogether. The code that I’m using is taken from the WordPress Codex. Any help would be appreciated. This is what I have at the moment:
<?php $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1; $args = array( 'posts_per_page' => 3, 'paged' => $paged ); $the_query = new WP_Query( $args ); ?> <?php if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?> <p><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></p> <?php endwhile; ?> <!-- pagination --> <?php next_posts_link(); ?> <?php previous_posts_link(); ?> <?php else : ?> <!-- No posts found --> <?php endif; ?>
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Loop with pagination only showing two pages’ is closed to new replies.