the_tags

函式
the_tags ( $before = null, $sep = ', ', $after = '' )
引數
  • (string) $before Optional. String to use before the tags. Defaults to 'Tags:'.
    Required:
    Default: null
  • (string) $sep Optional. String to use between the tags. Default ', '.
    Required:
    Default: ', '
  • (string) $after Optional. String to use after the tags. Default empty.
    Required:
    Default: (empty)
定義位置
相關方法
get_the_tagsthe_metaget_tagsthe_termshas_tag
引入
2.3.0
棄用
-

tags是一個WordPress函式,它顯示分配給當前文章的標籤列表。它可用於為使用者提供快速查詢相關內容的方法。

顯示一個文章的標籤。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function the_tags( $before = null, $sep = ', ', $after = '' ) {
if ( null === $before ) {
$before = __( 'Tags: ' );
}
$the_tags = get_the_tag_list( $before, $sep, $after );
if ( ! is_wp_error( $the_tags ) ) {
echo $the_tags;
}
}
function the_tags( $before = null, $sep = ', ', $after = '' ) { if ( null === $before ) { $before = __( 'Tags: ' ); } $the_tags = get_the_tag_list( $before, $sep, $after ); if ( ! is_wp_error( $the_tags ) ) { echo $the_tags; } }
function the_tags( $before = null, $sep = ', ', $after = '' ) {
	if ( null === $before ) {
		$before = __( 'Tags: ' );
	}

	$the_tags = get_the_tag_list( $before, $sep, $after );

	if ( ! is_wp_error( $the_tags ) ) {
		echo $the_tags;
	}
}

常見問題

FAQs
檢視更多 >