0

I want to display the top 10 child taxonomies, no parent.

This code gets 1 top parent taxonomy, then only displays it's 10 children. I would like to grab top 10 child taxonomies of all parents of taxonomy.

By top, I mean most populated of course.

<?php     
wp_list_categories('number=10&show_count=0&orderby=count&order=DESC&title_li=&hierarchical=0&taxonomy=cars-by') 
?>
0

maybe you have to use this

$categories=get_categories(
    array( 'parent' => $cat->cat_ID )
);

Then, in a loop, display this array because you can't do it with an echo

foreach ($categories as $c) {
    var_dump($c);
    // what you really want instead of var_dump is something to
    // to create markup-- list items maybe, For example...
    echo '<li>'.$c->cat_name.'</li>';
}
1
  • I am a bit confused, as to what loop to place the second part in. I am just wanting to display the top 10 child taxonomy links. – Joe Landry May 17 '19 at 17:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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