Dispaly taxonomy using custom post type
-
helllo i created custom post type and select taxonomy for custom post type i want to dispaly that how can i change this code my code is :
$custom_terms = get_terms(‘mytaxonomy’);
foreach($custom_terms as $custom_term) {
// wp_reset_query();
$args = array(‘post_type’ => ‘testimonials’,
‘tax_query’ => array(
array(
‘taxonomy’ => ‘mytaxonomy’,
‘field’ => ‘slug’,
‘terms’ => $custom_term->slug,
),
),
);$loop = new WP_Query($args);
if($loop->have_posts()) {
echo ‘<h2>’.$custom_term->name.'</h2>’;while($loop->have_posts()) : $loop->the_post();
echo ‘‘.get_the_title().’‘;
endwhile;
}
}
- The topic ‘Dispaly taxonomy using custom post type’ is closed to new replies.