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

2021年3月2日 飞飞 阅读(1.22K)
知识付费主题,优惠促销中:xx-blog主题

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

函数

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主题网

第一时间了解最新网络动态
关注博主不迷路~

未经允许不得转载:xx主题网 » wordpress获取某个文章所在分类的函数:get_the_term_list
分享到:

评论抢沙发

要发表评论,您必须先

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏

扫码关注微信公众号

扫描关注xx主题网