single_month_title

Sponsored Link

現在のページに年月のタイトルを表示または返します。このタグは、現在のページ(毎月のアーカイブページが表示されている時に発生)にWordPressによって渡されている引き数が月アーカイブのときにのみ動作します。

Sponsored Link

Displays or returns the month and year title for the current page. This tag only works when the m or archive month argument has been passed by WordPress to the current page (this occurs when viewing a monthly archive page).

注:single_month_titleのタグは、日付アーカイブページ上のみ動作し、カテゴリーやその他のテンプレート上では動作しません。

Note: This tag works only on date archive pages, not on category templates or others.

タイトルの後にセパレーターを配置するサポートはしていませんが、prefixパラメーターを空白にする事によって、手動で区切られたタイトルを設定する事が出来ます。
prefixは、自動的にprefixの間のスペースを配置しないので、スペースを配置したい場合は、パラメーター値が最後にスペースを持っている必要があります。

It does not support placing the separator after the title, but by leaving the prefix parameter empty, you can set the title separator manually. The prefix does not automatically place a space between the prefix, so if there should be a space, the parameter value will need to have it at the end.

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

<?php single_month_title( $prefix, $display ) ?> 

デフォルトの使い方

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

single_month_titleのパラメーター

prefix

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

(string) (optional) Text to place 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

戻り値

生成されたタイトルは下記の用になります:

The generated title will be:

prefix + MONTH + prefix + YEAR

prefixパラメータが’*’の場合、例えばこのようになります:

If prefix parameter is ‘*’, an example would be:

*February*2004

改行出年月を表示する方法

改行出年月を配置して、タイトルを表示します。

Displays the title, placing month and year on new lines.

<p><?php single_month_title('<br />') ?></p>
December
2004

$my_month変数を使用する方法

$my_month変数に割り当てられたタイトルを返します。変数の値は、その結果PHPエコーコマンドと共に表示されます。

Returns the title, which is assigned to the $my_month variable. The variable’s value is then displayed with the PHP echo command.

<?php $my_month = single_month_title('', false); echo $my_month; ?>

関連テンプレートタグ

the_time, the_date, the_date_xml, the_modified_time, the_modified_date, the_modified_author, single_month_title, get_the_time, get_day_link, get_month_link, get_year_link, get_calendar

Sponsored Link