get_categories($args)函数
wordpress框架中的get_categories($args)可以获取所有分类目录的信息。
$args参数定义如下
$args = array( 'type' => 'post', 'child_of' => 0, 'parent' => '', 'orderby' => 'name', 'order' => 'ASC', #排序方式 'hide_empty' => 1, #是否隐藏空的目录 默认隐藏(经测试传入布尔类型也可以) 'hierarchical' => 1, 'exclude' => '', 'include' => '', 'number' => '', 'taxonomy' => 'category', 'pad_counts' => false );
函数的返回值类型
stdClass Object ( [term_id] => 106 #分类的id [name] => Category Name #分类名称 [slug] => category-name #分类的别名 [term_group] => 0 [term_taxonomy_id] => 108 [taxonomy] => category [description] => This is the category description. [parent] => 62 [count] => 17 [filter] => raw [cat_ID] => 106 [category_count] => 17 [category_description] => This is the category description. [cat_name] => Category Name [category_nicename] => category-name [category_parent] => 62 )
文章评论