I’d like to display only first level children of my custom taxonomy categories
I’am using wp 3.8

I’ve something like for my taxonomy “listing_category”:
Category 1
SubCattegoy1
Subsub category1

I’d like to display only a link to “sub category1″ when I’am on “Category 1″ (not “subsub category1″). With the code below It displays all sub cat and subsub cat :

$taxonomy_name = 'listing_category';
$queried_object = get_queried_object();
$term_id = $queried_object->term_id;
$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>';

Any ideas to help me ? Thanks

Read more here:: Display only first level children of my custom taxonomy categories


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: