Same posts being displayed on next page (pagination)
-
Hi folks,
There’s a lot of posts on this subject, however, none of them seem to solve my problem. I’ve made a few page templates that access the post loop (not pages) outside of the main loop.php file.
The problem is that, upon navigating to the next page, the same posts are being shown.
Here’s my code, in full, for this area:
<div class="container_12"> <div class="events-landing-rest-container"> <?php $args = array( 'cat' => '8', 'post_type' => 'post', 'posts_per_page' => 6, 'offset' => 1, 'paged' => ( get_query_var('paged') ? get_query_var('paged') : 1), ); query_posts($args); while (have_posts()) : the_post(); ?> <div class="prefix_1 grid_5 events-landing-rest"> <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <?php if ( has_post_thumbnail() ) { ?> <a class="post-featured-image" href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" > <?php the_post_thumbnail(); ?> </a> <?php } ?> <header> <h2><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'starkers' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2> <?php starkers_posted_on(); ?> </header> <?php the_excerpt(); ?> <footer> <p><?php if ( count( get_the_category() ) ) : ?> <?php printf( __( '%2$s', 'starkers' ), 'entry-utility-prep entry-utility-prep-cat-links', get_the_category_list( ', ' ) ); ?> | <?php endif; ?> <?php comments_popup_link( __( 'Leave a comment', 'starkers' ), __( '1 Comment', 'starkers' ), __( '% Comments', 'starkers' ) ); ?></p> <div class="social-sharing"> <a class="ss-facebook" href="http://www.facebook.com/sharer/sharer.php?u=<?php the_permalink(); ?>">Share on Facebook</a> <a class="ss-twitter" href="https://twitter.com/share?&text=<?php the_title(); ?> via%20@Corridor8&url=<?php the_permalink(); ?>">Share on Twitter</a> </div> </footer> </article> </div> <?php endwhile; // End the loop. Whew. ?> </div></div> <?php /* Display navigation to next/previous pages when applicable */ ?> <div class="container_12"> <div class="prefix_1 grid_11"> <nav class="prev-next-container"> <span class="newer-posts"><?php previous_posts_link( __( '← Newer events', 'starkers' ) ); ?></span> <span class="older-posts"><?php next_posts_link( __( 'Older events → ', 'starkers' ) ); ?></span> </nav> </div> </div> <?php wp_reset_query();?>
Thanks,
Richard
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘Same posts being displayed on next page (pagination)’ is closed to new replies.