List only 1st level of sub taxonomies
-
I want to display only 1st level of sub taxonomies, below is my code,it’s just not working, can anyone please tell whats wrong with my code?? Many thanks.
<?php $term_id = 31; $taxonomy_name = 'kosher_category'; $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>'; ?>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘List only 1st level of sub taxonomies’ is closed to new replies.