【函数介绍】
获得指定分类,以数组或是对象的形式返回。
【函数用法】
<?php get_category( $category, $output, $filter ) ?>
【参数】
$category
(integer|object) (必须) 分类ID或者分类数据对象
默认: None
$output
(string) (可选) 输出格式,可以是: OBJECT, ARRAY_A, 或者 ARRAY_N
默认: OBJECT
$filter
(string) (可选)默认是 raw 或者 wordpress如果没定义过滤器filter会提供.
默认: ‘raw’
【返回值】
返回值为$output参数来定义
这里主要讲一下对象类型的返回值,
都有注释,请自行参阅。
stdClass Object
(
//ID 分类和标签混编
[term_id] => 5
//分类名
[name] => Cat Name
//分类别名
[slug] => cat
//N/A
[term_group] => 0
//同 term_id
[term_taxonomy_id] => 5
//分类法,也就是分类还是标签
[taxonomy] => category
//分类描述
[description] =>
//父级ID
[parent] => 70
//N/A
[count] => 0
//分类ID
[cat_ID] => 5
//N/A
[category_count] => 0
//同 description
[category_description] =>
//同 name
[cat_name] => Category Name
//同 slug
[category_nicename] => category-name
//同 parent
[category_parent] => 70
)