Adding an offset to a loop without killing pagination
-
I’m looking to apply a featured style to the first post on my homepage, and use a standard style for every post thereafter.
My loops look like:
<?php if ( is_home() and !is_paged() ) { ?> <!-- featured --> <?php query_posts('&showposts=1'); ?> <?php while (have_posts()) : the_post(); ?> <?php the_title(); ?> <?php the_excerpt(); ?> <?php endwhile; ?> <?php } ?> <!-- standard --> <?php $page = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts("&paged=$page"); ?> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div class="post" id="post-<?php the_ID(); ?>"> <?php the_title(); ?> <div class="entry"> <?php the_content('» Read More'); ?> </div> </div> <?php endwhile; ?> <!-- pagination --> <div class="navigation"> <div class="alignleft"><?php next_posts_link('« Older Entries') ?></div> <div class="alignright"><?php previous_posts_link('Newer Entries »') ?></div> </div> <?php else : ?> <p>404 message</p> <?php endif; ?>
The problem arises when I try to add a offset=1 to the second loop. It either breaks the pagination, or offsets the top post on every other page.
Is there an easier way to go about this, or is there another way to add the offset to the code above and have it work?
- The topic ‘Adding an offset to a loop without killing pagination’ is closed to new replies.