1$terms = get_terms( array(
2 'taxonomy' => 'taxonomy_name_or_slug',
3 'hide_empty' => true,
4) );
5foreach ($terms as $term){
6 echo $term->slug;
7 echo $term->name;
8 echo "<br><br>";
9}
1$index_query = new WP_Query(array('post_type' => 'company', 'posts_per_page' => '-1', 'order' => 'DESC'));
2
3while ($index_query->have_posts()) : $index_query->the_post();
4
5 $taxonomy_ar = get_the_terms($post->ID, 'tax-name');
6
7 $output = '<span class="btn">';
8 foreach($taxonomy_ar as $taxonomy_term) {
9 $output .= '<a href="'.get_term_link($taxonomy_term->slug, 'title').'">'.$taxonomy_term->name.' <span class="label">'.$taxonomy_term->count.'</span></a> ';
10 }
11 $output .= '</span>';
12
13 echo $output;
14
15endwhile;
16