[英]Remove pagination on My account orders list to make it one page in woocommerce
[英]How can I use the WooCommerce pagination function on the my account orders page?
我目前正在嘗試在MyAccount - > Orders頁面上替換WooCommerce的默認分頁。 分頁顯示但我目前的問題是,鏈接出錯頁碼。 因此,例如,當我在第2頁時,所有其他鏈接也指向頁面,但它必須是(1)對於頁面1,鏈接到此頁面,依此類推:
<?php if ( 1 < $customer_orders->max_num_pages ) : ?>
<nav class="page-pagination">
<?php
$base = esc_url( wc_get_endpoint_url( 'orders', $current_page ) );
echo paginate_links( apply_filters( 'woocommerce_pagination_args', array(
'base' => $base,
'format' => '',
'add_args' => false,
'current' => max( 1, $current_page ?? wc_get_loop_prop( 'current_page' ) ),
'total' => $customer_orders->max_num_pages,
'prev_text' => '←',
'next_text' => '→',
'type' => 'list',
'end_size' => 3,
'mid_size' => 3,
) ) );
?>
</nav>
<?php endif; ?>
也許你知道我怎么能讓這個工作?
我發現了這個問題。 也許它有一天會幫助你:
<?php if ( 1 < $customer_orders->max_num_pages ) : ?>
<nav class="page-pagination">
<?php
$base = esc_url( wc_get_endpoint_url( 'orders' ) );
echo paginate_links( apply_filters( 'woocommerce_pagination_args', array(
'base' => $base . '%_%',
'format' => '%#%/',
'add_args' => false,
'current' => max( 1, $current_page ),
'total' => $customer_orders->max_num_pages,
'prev_text' => '←',
'next_text' => '→',
'type' => 'list',
'end_size' => 3,
'mid_size' => 3,
) ) );
?>
</nav>
<?php endif; ?>
問題是基礎和格式。 我把它們留空是因為我確信我不需要這個(這是愚蠢的)。 所以這是一個工作示例,您可以在您的訂單表下放置以顯示WC分頁符。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.