[resolved] Custom query pagination on homepage custom page template (4 posts)

  1. Alessandro Tesoro
    Posted 2 years ago #


    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

    			$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 );
    				$listing_loop->have_posts()) :
    				while ( $listing_loop->have_posts() ) : $listing_loop->the_post();
    					the_title(); echo "<br/><br/>";
    				wp_pagenavi( array( 'query' => $listing_loop ) );
    			 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".

    Thank you.


  2. Lester Chan
    Plugin Author

    Posted 2 years ago #

    You have to use "page" if you are on static front page. If it is not working it might be other thing.

    Since you are using custom post type, it might be related http://wordpress.org/support/topic/custom-post-type-pagination-not-working-2?replies=8#post-5424175

  3. Alessandro Tesoro
    Posted 2 years ago #

    I just tried that but it doesn't work, and yes i've set "page" in


    for the "paged" $args key

    Any idea ? Even with wpdebug on, no error messages

  4. Lester Chan
    Plugin Author

    Posted 2 years ago #

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic


No tags yet.