0
我有下一个代码:Woocommerce类别描述
<?php
global $post;
$args = array('taxonomy' => 'product_cat');
$terms = get_the_terms($category->slug,'product_cat', $args);
$count = count($terms);
if ($count > 0) {
foreach ($terms as $term) {
echo '<div style="direction:rtl;">';
echo $term->description;
echo '</div>';
}
}
?>
该代码将显示类别描述。问题 - 在子类别中,它将显示子类别描述+父级描述。
我如何显示描述分开:在父 - 父母的描述,和子 - 只有子描述?