List categories, subcategories and posts from custom taxonomy and custom post type
You just need to tweak the logic so that if ( have_posts() ) : is only run if get_term_children() is empty, which it will be on the lowest level: $term = get_queried_object(); $term_id = $term->term_id; $taxonomy_name = $term->taxonomy; $termchildren = get_term_children( $term_id, $taxonomy_name ); if ( ! empty( $termchildren ) ) { echo ‘<ul>’; foreach … Read more