介绍

single_month_title() 用于返回“月”、“年”值,在date.php的archive页面,其他页面不支持。

使用

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

默认

<?php single_month_title(); ?> 

参数

prefix
(string) (optional) 标题前返回值
Default: None
display
(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
If prefix parameter is ‘*’, an example would be:

*February*2004

示例

月份和年换行:

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

使用 $my_month 变量
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; ?>