以HTML列表或自定义格式显示帖子的类别列表。
原型
the_category( string $separator = '', string $parents = '', int $post_id = false )
参数
$separator
(string)
(Optional)
类别之间的分隔符。默认情况下,链接放在无序列表中。空字符串将导致默认行为。
$parents
(string)
(Optional)
如何显示父母。
$post_id
(int)
(Optional)
发布ID以检索类别。
源文件
路径:wp-includes/category-template.php
<?php
...
function the_category( $separator = '', $parents = '', $post_id = false ) {
echo get_the_category_list( $separator, $parents, $post_id );
}
...
?>
其他
英文文档:https://developer.wordpress.org/reference/functions/the_category/