Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

My client's home page displays a paginated list of posts with thumbnails. Each list item, when clicked, navigates to a single post or page, and then uses a separate query to generate the same list of posts at the page footer.

Pagination works just fine on the home page, however, he wants the list underneath single posts to be paginated the same as the home page.

That is, we would be at website.com/post-12345 and it would show a list of posts 1-12 underneath. There would be "newer posts" and "older posts" buttons which should swap the list of posts 1-12 for a list of posts 13-24, for example, while displaying the same post, ie remaining at website.com/post-12345.

I thought of simply calling all the posts via get_posts() and switching between them using JavaScript, but there will eventually be hundreds of posts and thumbnails and the page would take forever to load.

Is there a way to achieve this type of pagination that isn't so clumsy?

I'm open to solutions in PHP, JavaScript, even Ajax.

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

From the WordPress Codex, I believe you want the function paginate_links

http://codex.wordpress.org/Function_Reference/paginate_links

Example: <?php echo paginate_links( $args ) ?>

share|improve this answer
    
That is indeed what we ended up using, although it does not answer the question of how to get the same post to continue displaying. We just settled for navigating to another given page of posts. –  Isaac Lubow Jun 11 '12 at 7:15
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.