Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

i have a custom post type with a custom taxonomy (to show some "best practice" examples on my website). On the single-post-page (single-bestpractice.php) i wanted to show all the terms (categories) like this:

Parent: Child, Child, Child

I tried this code:

<?php $customPostTaxonomies = get_object_taxonomies('bestpractice');
if(count($customPostTaxonomies) > 0)
{
foreach($customPostTaxonomies as $tax)
{
$args = array(
'orderby' => 'name',
'show_count' => 0,
'pad_counts' => 0,
'hierarchical' => 1,
'taxonomy' => $tax,
'title_li' => ''    
wp_list_categories( $args );
}
} ?>

which outputs:

Child, Child, Parent, Child,

…so, is there a way to sort it by parent/child and make the parent one start with a ":" and remove the "," of the last child?

thanx, Jochen

share|improve this question
add comment

1 Answer

You might like to follow this post as well as it appears to be essentially the same... Display the Terms from a Custom Taxonomy Assigned to a Post(inside the loop) in Hierarchial Order

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.