wp_pagenavi not working (solution)

2019-08-30 12:20发布

Had a minor problem with this neat plugin and solved it. It is said that wp_pagenavi does not work with eg. WP_query(). This should be also noted with get_posts(), did not see anything from this plugin. When changed to query_posts() then navi plugin started to work again.

1条回答
虎瘦雄心在
2楼-- · 2019-08-30 13:10

This form works:

 //if not exists assigns value 1
 $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; 

 //query 5 posts
 query_posts("posts_per_page=5&paged=$paged");
查看更多
登录 后发表回答