This question already has an answer here:
- How to fix pagination for custom loops? 5 answers
I am trying to show all published posts of my custom post type and I wrote this $query = new WP_Query(array( 'post_type' => 'x-video', 'post_status' => 'publish', 'posts_per_page' => -1 )); /loop code/ pagenavi();
This query is retrieving all published posts at once and I am looping through the results and displaying one page.
What I need is, I want it to be paginated with 12 posts per page. How can I do that?
If I put 'posts_per_page' => 5 then it is showing only 5 posts but not pagination