你能试试下面的代码吗?
$paged = ( get_query_var( \'paged\' ) ) ? get_query_var( \'paged\' ) : 1;
$woo_home_query = array(
\'post_type\' => \'product\',
\'posts_per_page\' => $top_selling_products_nr,
\'meta_key\' => \'total_sales\',
\'paged\' => $paged,
\'orderby\' => \'meta_value_num\'
);
<?php if ( $woo_home_query->have_posts() ) : ?>
<div class="products container grid-wrapper clear">
<div class="row">
<?php
while ( $woo_home_query->have_posts() ) : $woo_home_query->the_post();
wc_get_template_part( \'content\', \'product\' );
endwhile;
?>
</div>
<?php
$total_pages = $woo_home_query->max_num_pages;
if ($total_pages > 1){
$current_page = max(1, get_query_var(\'paged\'));
echo paginate_links(array(
\'base\' => get_pagenum_link(1) . \'%_%\',
\'format\' => \'/page/%#%\',
\'current\' => $current_page,
\'total\' => $total_pages,
\'prev_text\' => __(\'« prev\'),
\'next_text\' => __(\'next »\'),
));
}
?>
</div>
<?php endif; ?>