Pagination button shows the same posts
-
Hello,
My Pagination isn’t working. When I click the “Older Posts” link, it just takes me to the same page. I’m featuring the most recent post and then offsetting the others by one. I’d like to get the page to paginate after the 3 overall post. Here’s the code that I’m using:<div id="featured-box-main"> <?php $latest = new WP_Query(array( 'posts_per_page' => 1)); ?> <?php while( $latest->have_posts() ) : $latest->the_post(); ?> <?php if (has_post_thumbnail()) : ?> <figure> <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('', array('class' => 'box')); ?></a> </figure> <h3><a href="<?php the_permalink(); ?>"> <?php the_title();?> </a> <?php echo fb_like_button(); ?><div class="dontsee"><?php the_excerpt();?></div> <?php endif; endwhile;?> </div> <div id="secondary-posts"> <?php $latest2 = new WP_Query(array( 'posts_per_page' => 2, 'offset' => 1 )); ?> <?php while( $latest2->have_posts() ) : $latest2->the_post(); ?> <?php /* * Include the Post-Format-specific template for the content. * If you want to override this in a child theme, then include a file * called content-___.php (where ___ is the Post Format name) and that will be used instead. */ get_template_part( 'template-parts/content-offset', get_post_format() ); ?> <?php endwhile; ?> <?php the_posts_navigation(); ?> </div>Thanks for your help!
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
The topic ‘Pagination button shows the same posts’ is closed to new replies.