the_category

函数
the_category ( $separator = '', $parents = '', $post_id = false )
参数
  • (string) $separator Optional. Separator between the categories. By default, the links are placed in an unordered list. An empty string will result in the default behavior.
    Required:
    Default: (empty)
  • (string) $parents Optional. How to display the parents. Accepts 'multiple', 'single', or empty. Default empty string.
    Required:
    Default: (empty)
  • (int) $post_id Optional. ID of the post to retrieve categories for. Defaults to the current post.
    Required:
    Default: false
定义位置
相关方法
the_category_idthe_category_rssget_the_categoryhas_categorythe_category_head
引入
0.71
弃用
-

the_category – 这个函数用来显示分配给文章的一个或多个类别。它需要几个参数,允许自定义输出,如多个类别之间的分隔符,以及是否链接到类别存档页面。

以HTML列表或自定义格式显示一个文章的类别列表。

function the_category( $separator = '', $parents = '', $post_id = false ) {
	echo get_the_category_list( $separator, $parents, $post_id );
}

常见问题

FAQs
查看更多 >
闪电侠

(工作日 10:00 - 18:30 为您服务)

2026-01-28 22:09:22

您好,无论是售前、售后、意见建议……均可通过联系工单与我们取得联系。

您也可选择聊天工具与我们即时沟通或点击查看:

您的工单我们已经收到,我们将会尽快跟您联系!
取消
选择聊天工具: