WordPress:如何从一个类别中获得第一级子级?
我想知道是否有一个函数只返回第一级子类别子项。
Cat 1
Sub-1.1
Sub-1.2
Sub-1.2.1
Cat 2
Sub-2.1
这里我只想要:Sub-1.1、Sub-1.2 和 Sub-2.1
因为使用带有 child_of 参数的 get_categories 会给我带来所有子节点,直到最后一个节点:
get_categories('orderby=id&show_count=0&title_li=&use_desc_for_title=1&child_of='.$this_category->cat_ID);
谢谢
I want to know if has a function that return only the first level of subcategories children.
Cat 1
Sub-1.1
Sub-1.2
Sub-1.2.1
Cat 2
Sub-2.1
Here I want only: Sub-1.1, Sub-1.2 and Sub-2.1
Cause using get_categories with child_of parameter brings me all children until the last node:
get_categories('orderby=id&show_count=0&title_li=&use_desc_for_title=1&child_of='.$this_category->cat_ID);
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
请尝试
Please try