admin管理员组文章数量:1429488
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>';
}
本文标签: wp queryDisplay All Top Child CategoriesTaxonomy
版权声明:本文标题:wp query - Display All Top Child CategoriesTaxonomy 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745488417a2660490.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论