函数
函数:get_the_term_list(参数1,[选填]参数2,[选填]参数3,[选填]参数4)
描述:根据文章ID来获取文章的类别等信息
参数
参数1:
$post_id:文章ID
参数2:
默认为空,设置输出后字符串的左侧
参数3:
默认为空,设置输出后分类左右侧
参数4:
默认为空,设置输出后字符串的右侧
使用方法
使用方法
<?php
$post_id = 1; // 文章ID
// 列举该文章的分类标签
echo get_the_term_list($post_id, 'category', '<ul><li>', '</li><li>', '</li></ul>');
// 列举该文章的Tags标签
echo get_the_term_list($post_id, 'post_tag', '<ul><li>', '</li><li>', '</li></ul>');
// 列举该文章的自定义分类标签 - 自定义分类(custom_category)
// echo get_the_term_list($post_id, 'custom_category', '<ul><li>', '</li><li>', '</li></ul>');
?>