我找到了答案:
1) 删除主题函数中的woocommerce分页。php:
remove_action( \'woocommerce_before_shop_loop\', \'storefront_woocommerce_pagination\', 30 );
storefront woocommerce template hooks
2) 使用以下代码在函数中自定义分页。php:
function bittersweet_pagination() {
global $wp_query;
$big = 999999999; // need an unlikely integer
$pages = paginate_links( array(
\'base\' => str_replace( $big, \'%#%\', esc_url( get_pagenum_link( $big ) ) ),
\'format\' => \'?paged=%#%\',
\'current\' => max( 1, get_query_var(\'paged\') ),
\'total\' => $wp_query->max_num_pages,
\'type\' => \'array\',
) );
if( is_array( $pages ) ) {
$paged = ( get_query_var(\'paged\') == 0 ) ? 1 : get_query_var(\'paged\');
echo \'<div class="pagination-wrap"><ul class="pagination">\';
foreach ( $pages as $page ) {
echo "<li>$page</li>";
}
echo \'</ul></div>\';
}
}