<?php the_posts_pagination( array(
'show_all' => true,
'prev_next' => false,
'add_args' => false,
'add_fragment' => '',
) ); ?>
'posts_per_page' => '2',
'posts_per_archive_page' => '2',
$term = get_queried_object();
$term_slug = $term->slug;
$paged = ( get_query_var( 'page' ) ) ? get_query_var( 'page' ) : 1;
$_posts = new WP_Query( array(
'post_type' => 'product',
'posts_per_page' => 10,
'paged' => $paged,
'tax_query' => array(
array(
'taxonomy' => 'product-category',
'field' => 'slug',
'terms' => $term_slug,
),
),
) );
global $wp_query;
$tmp_query = $wp_query;
$wp_query = null;
$wp_query = $_posts;
if ( $_posts->have_posts() ) :
while ( $_posts->have_posts() ) :
$_posts->the_post();
get_template_part( 'template-parts/content-product', 'preview' );
endwhile;
the_posts_pagination( array(
'type' => 'list',
'prev_text' => '<i class="fas fa-angle-double-left"></i>',
'next_text' => '<i class="fas fa-angle-double-right"></i>',
) );
else :
get_template_part( 'template-parts/content', 'none' );
endif;
$wp_query = null;
$wp_query = $tmp_query;
wp_reset_postdata();