调用单独某个分类可以用get_category()这个方法
比如调用id等于4的分类的名称
<?php
$category = get_category(4);
echo $category->name;
?>
$category = get_category(4);
echo $category->name;
?>
get_category(4)获取到的是一个对象,可以通过对象访问符"->"调用其中的值
WP_Term Object
(
[term_id] => 4
[name] => 维护专区
[slug] => weihu
[term_group] => 0
[term_taxonomy_id] => 4
[taxonomy] => category
[description] =>
[parent] => 0
[count] => 0
[filter] => raw
[cat_ID] => 4
[category_count] => 0
[category_description] =>
[cat_name] => 维护专区
[category_nicename] => weihu
[category_parent] => 0
)
(
[term_id] => 4
[name] => 维护专区
[slug] => weihu
[term_group] => 0
[term_taxonomy_id] => 4
[taxonomy] => category
[description] =>
[parent] => 0
[count] => 0
[filter] => raw
[cat_ID] => 4
[category_count] => 0
[category_description] =>
[cat_name] => 维护专区
[category_nicename] => weihu
[category_parent] => 0
)