使用 get_terms函数可以自由读自定义分类。
get_terms 函数共有 2 个参数。
第 1 个是自定义分类名。
第 2 个是各种设置的数组。
除了自定义分类名以外,其它基本和 get_categories 函数相同。
hide_empty不包含没有文章的 term 为 true。 默认值 true
child_of 获取该 ID 的子孙 term。hide_empty 为 true。 默认值 0
parent 获取该 ID 的子 term。 无默认值
hierarchical 为 true 则即使子 term 为空,只要它的子 term 不为空则也获取 默认 true
include 用逗号分隔需要获取的 termID 无默认值
exclude 用逗号分隔不需要获取的 termID 无默认值
pad_counts true 则包含子孙 term 的数量 默认 false
number 获取的数量 无默认值
orderby 指定排序顺序 id,name,slug,count,term_group 默认 name
order 升序 asc 降序 desc 默认 asc
评论0
最新资源