In case of wp_query
, you can’t use shortcode this way
<?php wp_pagenavi(); ?>
You need to use variable (in which you are storing wp_query) in array inside shortcode. Use shortcode like this instead. Replace above shortcode with below one.
<?php wp_pagenavi( array( 'query' => $query_slider ) ); ?>
UPDATE
This is a way in which I am using wp_query
to show products list without shortcode that you used to display products.
<?php
/*
Template Name: shine
*/
get_header(); ?>
<?php
$paged = get_query_var('paged') ? get_query_var('paged') : 1;
$args = array('post_type' => 'product',
'orderby' => 'title',
'order' => 'ASC',
'posts_per_page' => 5,
'paged' => $paged);
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
?>
<li style="list-style:none;">
<h3><a href="https://wordpress.stackexchange.com/questions/246228/<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title();?></a> (<?php echo get_the_date('d.m.Y');?>)</h3>
<a href="https://wordpress.stackexchange.com/questions/246228/<?php the_permalink() ?>" title="<?php the_title(); ?>">
<?php
/***** Thumbnail ******/
the_post_thumbnail(
array(120, 90),
array(
'class' => 'enter-class-here', //Specify class for product's image if any
'alt' => 'Preview unavailable', //Specify alternate text for products, in case if there is no products image
'title' => 'Enter-title-here' //Specify title if any
)
);
/******* Thumbnail Ends ********/
?> </a>
</li><hr />
<?php
endwhile; ?>
<?php wp_pagenavi( array( 'query' => $loop ) ); ?>
<?php get_footer();?>