show all terms of a custom taxonomy
$terms = get_terms( array(
'taxonomy' => 'taxonomy_name_or_slug',
'hide_empty' => true,
) );
foreach ($terms as $term){
echo $term->slug;
echo $term->name;
echo "<br><br>";
}
show all terms of a custom taxonomy
$terms = get_terms( array(
'taxonomy' => 'taxonomy_name_or_slug',
'hide_empty' => true,
) );
foreach ($terms as $term){
echo $term->slug;
echo $term->name;
echo "<br><br>";
}
Get taxonomies
$index_query = new WP_Query(array('post_type' => 'company', 'posts_per_page' => '-1', 'order' => 'DESC'));
while ($index_query->have_posts()) : $index_query->the_post();
$taxonomy_ar = get_the_terms($post->ID, 'tax-name');
$output = '<span class="btn">';
foreach($taxonomy_ar as $taxonomy_term) {
$output .= '<a href="'.get_term_link($taxonomy_term->slug, 'title').'">'.$taxonomy_term->name.' <span class="label">'.$taxonomy_term->count.'</span></a> ';
}
$output .= '</span>';
echo $output;
endwhile;
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us