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列表或自定義格式顯示一個文章的類別列表。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function the_category( $separator = '', $parents = '', $post_id = false ) {
echo get_the_category_list( $separator, $parents, $post_id );
}
function the_category( $separator = '', $parents = '', $post_id = false ) { echo get_the_category_list( $separator, $parents, $post_id ); }
function the_category( $separator = '', $parents = '', $post_id = false ) {
	echo get_the_category_list( $separator, $parents, $post_id );
}

常見問題

FAQs
檢視更多 >