标签:
get_term:直接从数据库中获取分类信息
get_the_category:使用post_id作为参数,先根据post_id查询对应的文章然后再返回对应的分类信息,如果没有文章信息则返回Null
//$term_id:分类ID号 //$taxonomy:category|link_category|nav_menu|自定义分类, 默认为category $term = get_term( $term_id, $taxonomy ); print_r(get_term(2,‘category‘)); //输出 stdClass Object ( [term_id] => 2 [name] => 最新公告 [slug] => notice [term_group] => 0 [term_taxonomy_id] => 2 [taxonomy] => category [description] => [parent] => 0 [count] => 1 [object_id] => 60 [filter] => raw )
标签:
原文地址:http://www.cnblogs.com/huangtailang/p/4832373.html