最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

wp query - Display All Top Child CategoriesTaxonomy

programmeradmin2浏览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') 
?>

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
Add a comment  | 

1 Answer 1

Reset to default 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>';
}
发布评论

评论列表(0)

  1. 暂无评论