这是一个非常新手的问题。但是我将如何按字母顺序对结果进行排序,以便 li 列表中的名称按顺序排列?
<?php
// FOR THE CATEGORIES (PRODUCT TYPE)
$terms_one = get_terms('product_cat');
$count_one = count($terms_one);
$i_one = 0;
echo '<ul class="submenu one filter option-set" data-filter-group="gem-type">';
echo '<li><a href="javascript:void(0)" data-filter-value="" class="selected">ALL</a>';
if ($count_one > 0) {
foreach ($terms_one as $term_one)
{
$i_one++;
$term_list_one .= '<li><a href="javascript:void(0)" data-filter-value=".'. $term_one->slug .'"> <span>'. $term_one->count .'</span>'. $term_one->name .'</a></li>';
if ($count_one != $i_one)
{
$term_list_one .= '';
} else {
$term_list_one .= '';
}
}
echo $term_list_one;
}
echo '</ul>';
?>