Displaying subcategories and then posts in taxonomy template

Please try this <?php $term = get_queried_object(); $term_id = $term->term_id; $taxonomy_name = $term->taxonomy; $termchildren = get_term_children( $term_id, $taxonomy_name );?> <?php foreach ( $termchildren as $child ) { $term = get_term_by( ‘id’, $child, $taxonomy_name ); ?> <li> <?php echo $term->name; ?> <?php echo $term->description; ?> </li> <?php } if ( have_posts() ) : /* Start the … Read more

Not Able to List CPT Based on Taxonomy Term

Check this code: <?php $custom_terms = wp_get_post_terms($post->ID, ‘service_tax’); $count = count($custom_terms); if ( $count > 0 ) { foreach($custom_terms as $custom_term) { $args = array(‘post_type’ => ‘services_cpt’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘service_tax’, ‘field’ => ‘slug’, ‘terms’ => $custom_term ), ), ); $loop = new WP_Query($args); if($loop->have_posts()) { echo ‘<div class=”col-md-4″>’; echo ‘<a class=”item-box” … Read more