WordPress Pagination Not Working: Solution

If you use query_post function on a theme’s homepage, you might land up messing up with the pagination function of WordPress.

Here is the quick fix to wordpress pagination (Next Previous Posts) function:

1. Add up the following line of code just BEFORE the query_post() function:

$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;

2. Add the variable $paged to your query_post function (notice the extra variable at the end of the query post function):

query_posts('orderby=date&order=DESC&posts_per_page=5&cat=blog&paged='.$paged);

Popularity: 4% [?]

This entry was posted in Wordpress, Wordpress Hacks. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *