0

<?php
$taxonomy = $atts['tax_name'];
$terms = get_terms($taxonomy, array(
'orderby' => 'count',
'hide_empty' => true
)
);
$hierarchy = _get_term_hierarchy($taxonomy);
foreach($terms as $term) {
if($term->parent) {
continue;
}
echo $term->name.'<br>';
if($hierarchy[$term->term_id]) {
foreach($hierarchy[$term->term_id] as $child) {
$child = get_term($child, $atts['tax_name']);
echo ' — '.$child->name.'('.$child->count.')<br>';
}
}
}
?>

Jagdish Sarma Asked question October 16, 2020
Add a Comment