wordpress获取某个文章所在分类的函数:get_the_term_list

219 阅读1分钟

这个函数用在自定义分类法中,获取对应文章所在的分类

函数

get_the_term_list($id$taxonomy$before=''$sep=''$after= ''

参数

$id – 帖子ID (必须)

$taxonomy – 分类法名称 (必须)

$before – 在列表之前,默认 ”

$sep – 使用的分割项

$after – 在列表之后,默认 ”

用法

$terms = get_the_term_list( $post->ID, 'xx-blog', '', ', ', '' );
echo $terms;

欢迎关注我的公众号“xx主题网”,原创技术文章第一时间推送。

文章来源:www.xxzhuti.com/706.html