1
我製作了一份帶有我的訂單列表的模板,並想按billing_first_name進行排序。我已經嘗試了排列但沒有成功:Woocommerce - 頁面模板 - 通過billing_first_name排序
<?php
global $woocommerce;
$args = array(
'post_type' => 'shop_order',
'post_status' => 'publish',
'posts_per_page' => -1,
'tax_query' => array(
array(
'taxonomy' => 'shop_order_status',
'field' => 'slug',
'terms' => array('processing', 'on-hold', 'pending', 'completed', 'cancelled', 'refunded', 'failed')
)
)
);
$loop = new WP_Query($args);
?>
<article id="tabela_inscricoes">
<div id="title_lista_inscritos">Order list</div>
<table cellspacing="0" cellpadding="2">
<tbody>
<?php
while ($loop->have_posts()) : $loop->the_post();
$order_id = $loop->post->ID;
$order = new WC_Order($order_id);
?>
<tr>
<td style="text-align:left;"><?php echo $order->billing_first_name; ?> <?php echo $order->billing_last_name; ?></td>
<td style="text-align:left;"><?php echo $order->billing_company; ?></td>
<td style="text-align:left;"><?php echo custom_status($order); ?></td>
</tr>
</tbody>
</table>
</article>
我該如何解決這個問題?
感謝