[Resolved] Custom query pagination on homepage custom page template
I’ve got an issue that i’ve never faced before and although i’ve followed all the instructions into the sticky topic here on the forum and also googled for a possible a solution i can’t figure out why this custom query on the homepage (static front page set to a custom page template).
The following query is into a custom page template set as static front page
<?php $args = array( 'post_type' => 'listing', 'posts_per_page' => get_field('listings_per_page','option'), 'paged' => get_query_var('page')); $listing_loop = new WP_Query( $args ); if( $listing_loop->have_posts()) : while ( $listing_loop->have_posts() ) : $listing_loop->the_post(); the_title(); echo "<br/><br/>"; endwhile; wp_pagenavi( array( 'query' => $listing_loop ) ); wp_reset_query(); else : ?> Nothing here <?php endif; ?>
I understand that for homepages i needed to change the “paged” to “page” so i did that, but it won’t work it stays on the same page no url change, if i change the “page” back to “paged” and remove the page from being a static front page, the pagination works fine. However i need to set this page template as static front page so this isn’t a solution.
Any idea why it won’t work? If it helps, i’ve set the permalinks to “post name”.
- The topic ‘[Resolved] Custom query pagination on homepage custom page template’ is closed to new replies.