Resetting post query after the first page.
-
I feel like this should be obvious to me, but maybe I’m just not getting enough sleep.
I set up a blog where I wanted the first post to display by itself at the top of the page in a different style, then the rest of the posts would be below it in a new section. This is working great, but when I click the navigation for the next page, it just shows that same posts again. How do I have the navigation continue to the next posts like normal, even though I did a query to start the loop?
Here’s my code.
<?php $top_query = new WP_Query('showposts=1'); ?> <?php while($top_query->have_posts()) : $top_query->the_post(); ?> <article class="post first"> //Post Content </article><!--post--> <?php endwhile; ?> <div class="content"> <div class="container"> <section class="main"> <?php query_posts('offset=1'); ?> <?php while(have_posts()) : the_post(); ?> <article class="post"> //Post Content </article><!--post--> <?php endwhile; ?> <div class="navigation"><h1><?php posts_nav_link('','? Back','More on the next page ?'); ?></h1></div> </section><!--main-->
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Resetting post query after the first page.’ is closed to new replies.