I have a WordPress site, where on the main page I list the content from more categories.
My question is, is there a plugin where I can paginate the results from a category? I mean something like $this->plugin_paginate('category_id');
or smth?
Best Regards,
If you’re using the standard WordPress loop, even with a
query_posts
for a category, pagination is automatic with the usualposts_nav_link
. Are you trying to paginate for more than one query and more than one category on the same page?Edit 11/20: I use this in several different places on one page to show the latest post in a category:
That link then goes to a category page that paginates for that category: Category Templates « WordPress Codex
I don’t know how to paginate different categories on the same page. Must be possible. Maybe ask in the WordPress forums.
This sounds like something that a simple, well-formed query_posts() call can do. I doubt that you’ll even need to rely on a plugin. 🙂
I’m going to assume that you’re familiar with the query_posts() function, so let’s go ahead and use this example as a base:
Now, to get the 11th to 20th posts from category 3 (that is, the NEXT 10 posts), we’ll want to use the [offset] parameter of query_posts():
For most purposes, that should be sufficient. However, you did mention that you plan on paginating category post lists from the main page alone? I’m assuming that you mean that you have multiple category post lists on your main page, and all these are paginated independently.
With something like that, it looks like you’ll have to work a bit with Javascript to do the work for you, along with what I illustrated above.
I believe you could do something like this:
Hope this will help you 🙂