single_tag_title

Sponsored Link

現在のページのタグのタイトルを表示または返します。

Sponsored Link

Displays or returns the tag title for the current page.

single_tag_titleのテンプレートタグ使用方法

<?php single_tag_title( $prefix, $display ); ?> 

デフォルトの使い方

<?php single_tag_title(
	'prefix'   => '', 
	'display'  => true ); ?>

single_tag_titleのパラメーター

$prefix

(string) (optional) タイトルの前に出力するテキストです。

(string) (optional) Text to output before the title.

Default: None

$display

(boolean) (optional) (TRUE)の場合タイトルを表示します。または、(FALSE)の場合PHP内で使用できるようにタイトルを返します。

(boolean) (optional) Display the title (TRUE), or return the title to be used in PHP (FALSE).

Default: TRUE

この例では、タグのタイトルに続く”Currently browsing ” テキストを表示します。

This example displays the text “Currently browsing ” followed by the tag title.

<p><?php single_tag_title('Currently browsing '); ?>.</p>
Currently browsing WordPress.

この例では、PHPで使用するために変数$current_tagを現在のタイトルタグに割り当てます。

This example assigns the current tag title to the variable $current_tag for use in PHP.

<?php $current_tag = single_tag_title("", false); ?>

変更ログ

Since: 2.3.0

関連テンプレートタグ

is tag, the_tags, tag_description, single_tag_title, wp_tag_cloud, wp_generate_tag_cloud, get_tags, get_the_tags, get_the_tag_list, get_tag_link

Sponsored Link