wp-pagenavi not working on custom query wordpress

I face very weird issue on wp-pagenavi plugin. I am using WooCommerce plugin it works perfectly. Now i make a page template and want to show all that products which product type is bundle, my products show but wp-pagenavi not working. I also try on blog page its working perfect there but not in my page template.

Here is my code:

Read More

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 about this but nothing found.

Related posts

Leave a Reply

1 comment