pagination - wp-pagenavi not working on custom query wordpress -


i face weird issue on wp-pagenavi plugin. using woocommerce plugin works perfectly. make page template , want show products product type bundle, products show wp-pagenavi not working. try on blog page working perfect there not in page template.

here code:

page template name

<?php     /*     template name: bundle products     */     get_header(); ?> 

my custome query

<?php     $paged = get_query_var('page') ? get_query_var('page') : 1;      $gb_bundle_args = array(                     'post_type' => 'product',                     'order' => 'desc',                     'paged' => $paged,                     'tax_query' => array(                         array(                             'taxonomy' => 'product_type',                             'field' => 'name',                             'terms' => 'bundle'                         )                     )             );     $gb_bundle_qry = new wp_query($gb_bundle_args);      if($gb_bundle_qry->have_posts()) :         while($gb_bundle_qry->have_posts()) :             $gb_bundle_qry->the_post();              the_title();             echo '<br />';         endwhile;     else :         echo "no bundle products";     endif;      wp_pagenavi();      wp_reset_query(); ?> 

i searched alot nothing found.

you need pass

      wp_pagenavi( array( 'query' => $gb_bundle_qry ) );        wp_reset_query(); 

hope helps you.


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -