【发布时间】:2013-10-08 20:11:12
【问题描述】:
我有下一个代码:
<?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>';
}
}
?>
代码将显示类别描述。问题 - 在子类别上,它将显示子类别描述 + 父描述。
如何单独显示描述:在父项中 - 父项描述,在子项中 - 仅子描述?
【问题讨论】:
标签: wordpress woocommerce