Hi
Have you tried with static id like this:
<?php
$term_id = 27;
$taxonomy_name = 'products';
$termchildren = get_term_children( $term_id, $taxonomy_name );
echo '<ul>';
foreach ( $termchildren as $child ) {
$term = get_term_by( 'id', $child, $taxonomy_name );
echo '<li><a href="' . get_term_link( $child, $taxonomy_name ) . '">' . $term->name . '</a></li>';
}
echo '</ul>';
?>
Thanks
Ahir
if that not work for you then here is full code.
$category = get_queried_object();
$parent_term_id = $category->term_id;
//$termchildren = get_terms('category',array('child_of' => $parent_id));
$taxonomies = array(
'taxonomy' => 'product-cat'
);
$args = array(
// 'parent' => $parent_term_id,
'child_of' => $parent_term_id
);
$terms = get_terms($taxonomies, $args);
if (sizeof($terms)>0)
{
echo '<ul class="b4u-inner-filters">';
foreach ( $terms as $term ) {?>
<li class="item-filter" id="<?php echo $term->term_id; ?>"><?php echo $term->name; ?></li>
<?php
}
echo '</ul>';
}
Let me know how this help you.
Thanks
Ahir
Unfortunatelly this code not helped
Here dump of array of child category. Looks strange that id’s is equal to keys
array(5) { [0]=> int(0) [1]=> int(1) [2]=> int(2) [3]=> int(3) [4]=> int(4) } int(27) string(11) "product_cat"