WordPress函数:the_category

一、函数简介

以HTML列表或自定义格式显示帖子的类别列表。(Displays category list for a post in either HTML list or custom format.)

 

二、函数参数

* @param 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.

* @param string $parents Optional. How to display the parents. Accepts 'multiple', 'single', or empty. Default empty string.

* @param int|false $post_id Optional. ID of the post to retrieve categories for. Defaults to the current post. */

 

三、函数案例

 

 

四、源代码

/**
 * Displays category list for a post in either HTML list or custom format.
 *
 * @since 0.71
 *
 * @param 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.
 * @param string    $parents   Optional. How to display the parents. Accepts 'multiple', 'single', or empty.
 *                             Default empty string.
 * @param int|false $post_id   Optional. ID of the post to retrieve categories for. Defaults to the current post.
 */
function the_category( $separator = '', $parents = '', $post_id = false ) {
	echo get_the_category_list( $separator, $parents, $post_id );
}

 

 

THE END