How to list next 10 posts combined with pagination
-
I’m using the following code to create a “next page” link that includes titles of the next ten posts. The idea here being that users may be intrigued to click through if they can see the next ten titles.
<div id="nextPageLink"><?php next_posts_link('« Older Entries') ?></div> <ul> <?php query_posts('showposts=10&offset=10'); ?> <?php while (have_posts()) : the_post(); ?> <li><a href="<?php echo get_permalink() ?>"><?php the_title(); ?></a></li> <?php endwhile; ?> </ul>
This works well, until the user goes to the next page, in which case they’re presented with the same 10 titles. Is there a way to have the offset increase by 10 depending on which page the user is on?
Or to put it another way, how can I grab the page number, stick it in a variable, and multiply the offest by that variable?
Thanks!!!
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘How to list next 10 posts combined with pagination’ is closed to new replies.