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')
?>
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')
?>
Share
Improve this question
asked May 15, 2019 at 18:38
Joe LandryJoe Landry
277 bronze badges
1 Answer
Reset to default 0maybe 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>';
}