How to get list of custom taxonomy terms and display count?
-
This is actually a three-part question.
1.) How do I get list all terms of my custom taxonomy (in this case, ‘audiocat’)?
2.) How do I display the count of each term? Example:
Rock (5) Pop (3)
3.) How do I sort them according to their parent? Example:
Rock (5) Subcategory (3) Pop (3) Sub category (1)
So far, I can get the list of all the terms from ‘audiocat’ but if they have more than one content, then it duplicates it. So I can’t proceed to my second problem.
Here’s how I query them:
<?php $audio = get_posts( array ( 'paged' => get_query_var('paged'), 'post_type' => 'audio', 'posts_per_page' => 10, 'order' => 'ASC', 'orderby' => 'meta_value', 'taxonomy' => 'audiocat', )); ?>
- The topic ‘How to get list of custom taxonomy terms and display count?’ is closed to new replies.