The WP_Pagenavi FAQ links to the following article to explain how to use the Pagenavi plugin with a secondary query by passing the wp_pagenavi()
function a query parameter.
From the tutorial:
$my_query = new WP_Query();
while ( $my_query->have_posts() ) : $my_query->the_post();
the_title();
// more stuff here
endwhile;
wp_pagenavi( array( 'query' => $my_query ) );
wp_reset_postdata(); // avoid errors further down the page
Related Posts:
- Pagination when using wp_query?
- Find out total number of pages in global query on archive page?
- Multiple WP_Query loops with Pagination
- WordPress Pagination Not Working – Always Showing First Pages Content
- get_query_var function not working at all
- get_query_var( ‘paged’ ) not working outside of homepage
- Pagination returns 404 after page 20
- paginate_links() adds empty href to first page and previous link
- Pagination with WP_Query is buggy – working for some pages, but not the others
- Get the number of posts from the current page results
- WP_Query and Pagination on a Static front page
- Pagination custom query
- Pagination/infinite scroll with WP_Query and multiple loops
- Pagination broken when merging search results with additional WP_Query
- WP_query and pagination?
- Query with pre_get_posts to get pagination
- Pagination is not working using WP_Query
- Transient pagination not working properly
- Injecting content with $wp_query->current_post restarts from zero on paged pages. How to inject content after X posts, regardless of pagination?
- Woocommerce custom loop to show all the products [closed]
- How to bring specific post to front of wordpress loop?
- Merged two WP_Queries, posts per page and pagination not working
- Intentionally exceed max_num_pages on main query without getting 404?
- Pagination 404 errors for author posts query on author.php
- Pagination problem after WP_Query with tag filtering
- Pagination stops at page 6
- Paginated HTML Sitemap
- Posts loop with pagination on a single post page
- Create ONE callback for all page templates, post filter queries + paginated pages, triggering pagination via AJAX
- Pagination is broken and I need help fixing it
- WP Pagination on Posts Search Results Page resulting from AJAX WP Query
- Create A Loop With A Variable Number of Posts For Each Bootstrap Row?
- Five posts from a category in footer
- The pagination on index.php doesn’t work on a first page
- paging in WP_Query on static page
- pagination with numbers for WP_User_Query
- WordPress pagination not working using WP_Query
- posts_per_page not working for first page of pagination
- Cutom wp_query for geolocation search, pagination not working
- Pagination inside of a edit page
- WP Query to have sticky posts first, with pagination and having a joint ‘posts per page’ arg with main loop
- Pagination on static Posts page
- WordPress Blog Posts with Pagination inside a Page/Post
- How do I get my custom query to work with search results after the first page?
- How to cache wp_query with pagination using transients?
- Pagination only won’t work in author template
- Removing duplicate values between two wordpress queries
- wp query error while paging the posts
- Stomping WP_Query in author archive to facilitate pagination with custom queries
- Pagination on template page for custom query redirecting to index.php
- Yoast primary category query modification
- Pagination in html table is not working
- Paging + WP Query
- WP_Query custom order and pagination
- Unable to paginate a custom page query
- Query Not working as expected
- WP_query paged pagination with excluded category still counts it
- max_num_pages says 4, yet I am only able to navigate to the third page
- Paginate pages with dynamic query
- filter posts by meta key with pagination
- Determining what post is displayed out of total posts found
- Trouble Making WP_Query paged
- Ajax (jquery) wp_query pagination returns -1
- Function the_posts_pagination() not compatible with WP_Query arguments
- paginate_links appearing on page but it doesn’t actually paginate – pagination on a static page with a dynamic `post_type` argument on a static page
- Pagination of custom page with custom fields query
- pre_get_posts pagination not working
- Pagination not working on archive.php template?
- WordPress Sub Category Archive, Show Extra Empty Page Number in Pagination
- Pagination unique to a widget
- Pagination inside the blog page not working
- Why pagination is not working with tax_query param?
- paginate_links method doesn’t show second page of my custom wp_query
- Wp_Query Post per page not working?
- Pagination Shows Up But Won’t Work on Custom Gallery Page
- Custom Query Pagination not working on static front page
- WordPress search page pagination displaying but not functional
- Paginated Post List on Front Page
- Combine WP_Query with array of custom data to single loop without breaking the pagination
- Pagination returns 404 after page 20
- WP_Query with Pagination and orderby meta_value_num showing duplicates
- Archive – Show Page Month Headers
- Query post Pagination Problem
- Pagination for custom query throws 404 errors on last pages [duplicate]
- Horizontally paginate through sets of blog posts?
- Pagination error WordPress multiple loop
- Comments orderby comment date not working
- Switched from query_posts to wp_query, pagination no longer working
- Pagination With Custom WP Query not functioning
- Ordering Custom WP_Query loop by meta key value with pagination
- Query specific number of posts for each post type in specific order
- Custom query (author is post_author or meta co_author) with Pagenavi pagination
- Pagination in custom query not working [duplicate]
- paginate_links() on page (shortcode output)
- WordPress Post Looping? [duplicate]
- Pagination showing same posts despite changing page
- error with $query->have_posts()
- Pagination with Custom Post Type not working on index.php: I get a 404
- Pagination on custom post type not working
- Pagenavi with archive page