Home / Blog / Query_posts() with WP-PageNavi

Query_posts() with WP-PageNavi

For WordPress theme designers who use WP-PageNavi plugin and query_posts() together, it is likely that the page numbers do not show posts correctly. All pages display the same posts no matter which page you are on. Here is how to use query_posts() correctly with WP-PageNavi:

Open the file with the query_posts() function, index.php for example.

Find:

query_posts('category_name=resources');

Replace with:

query_posts('category_name=resources'.'&paged='.get_query_var('paged'));

Learn how to use query_posts().

Tags: ,