Добавить в archive
<?php
$term = get_queried_object();
$list = wp_list_categories( array(
'taxonomy' => $term->taxonomy,
'parent' => $term->term_id,
'title_li' => '',
'depth' => 1,
'echo' => false,
));
if ( $list ) {
echo "<ul>$list</ul>";
} else {
// Nothing, do something else!
}
?>
Вариант 2
$queried_object = get_queried_object();
$parent = $queried_object->term_id;
$categories = get_term_children( $parent, 'product_cat' );
if ( $categories && ! is_wp_error( $category ) ) :
echo '<ul>';
foreach($categories as $category) :
$term = get_term( $category, 'product_cat' );
echo '<li>';
echo '<a href="'.get_term_link($term).'" >';
echo $term->name;
echo '</a>';
echo '</li>';
endforeach;
echo '</ul>';
endif;
Вариант 3
<?php
$term = get_queried_object()->term_id;
$termid = get_term($term, 'product_cat' );
if($termid->parent > 0)
{
$args = array(
'orderby' => 'name',
'order' => 'ASC',
'hide_empty' => false,
'child_of' => $termid->parent,
);
$siblingproducts = get_terms( 'product_cat', $args);
foreach ($siblingproducts as $siblingproduct) {
if ($siblingproduct->term_id == $term ) { ?>
<li>
<?php } else { ?>
<li>
<?php } ?>
<a href="<?php echo get_term_link( $siblingproduct ); ?>"><?php echo $siblingproduct->name; ?><?php echo "<span class='count'>" . $siblingproduct->count . "</span>"; ?></a></li>
<?php }
} else {
$args = array(
'orderby' => 'name',
'order' => 'ASC',
'hide_empty' => false,
'child_of' => $term
);
$subproducts = get_terms( 'product_cat', $args);
foreach ($subproducts as $subproduct) { ?>
<li> <a href="<?php echo get_term_link( $subproduct ); ?>"><?php echo $subproduct->name; ?><?php echo "<span class='count'>" . $subproduct->count . "</span>"; ?></a></li>
<?php }
}
?>





