WordPress: Template Tags/single month title:修订间差异

来自站长百科
跳转至: 导航、​ 搜索
(新页面: == Description == Displays or returns the month and year title for the current page. This tag only works when the <code>m</code> or archive month argument has been passed by WordPress to...)
 
无编辑摘要
第1行: 第1行:
== Description ==
== Description ==
== 描述 ==


Displays or returns the month and year title for the current page. This tag only works when the <code>m</code> or archive month argument has been passed by WordPress to the current page (this occurs when viewing a monthly archive page). Note: This tag only works on date archive pages, not on category templates or others.
Displays or returns the month and year title for the current page. This tag only works when the <code>m</code> or archive month argument has been passed by WordPress to the current page (this occurs when viewing a monthly archive page). Note: This tag only works on date archive pages, not on category templates or others.
为当前网页显示月份和年份标题。只有WordPress将<code>m</code>或者归档月份argument传到当前的网页的时候(当浏览按月归档的网页的时候,就会出现这种情况),这个标签才会运行。注:这个标签只在日期归档网页上运行,不在类别模板或者其它的模板上运行。


== Usage ==
== Usage ==


%%% <?php single_month_title('prefix', display) ?> %%%
%%% <?php single_month_title('prefix', display) ?> %%%
== 用法 ==
%%% <?php 单个_月份_标题('前缀', 显示) ?> %%%


The generated title will be:
The generated title will be:
产生的标题会是:


  prefix + MONTH + prefix + YEAR
  prefix + MONTH + prefix + YEAR
前缀+月份+前缀+年份


If prefix parameter is <tt>'*'</tt>, an example would be:
If prefix parameter is <tt>'*'</tt>, an example would be:
如果前缀参数是<tt>'*'</tt>,例子就是:
*February*2004


*February*2004
*2004年*2月


== Examples ==
== Examples ==


=== Month and Year on New Lines ===
=== Month and Year on New Lines ===
= 例子==
=== 新的文本行中的年份和月份 ===


Displays the title, placing month and year on new lines.
Displays the title, placing month and year on new lines.
在新的文本行中显示标题,放置年份和月份。


  &lt;p&gt;<?php single_month_title('&lt;br /&gt;') ?>&lt;/p&gt;
  &lt;p&gt;<?php single_month_title('&lt;br /&gt;') ?>&lt;/p&gt;
&lt;p&gt;<?php 单个_月份_标题('&lt;br /&gt;') ?>&lt;/p&gt;


<div style="border:1px solid blue; width:50%; padding:10px">December<br />
<div style="border:1px solid blue; width:50%; padding:10px">December<br />
2004</div>
<div style="border:1px 固体蓝; width:50%; padding:10px">十二月<br />
2004</div>
2004</div>




=== Using $my_month Variable ===
=== Using $my_month Variable ===
=== 使用 $我的_月份 变数 ===


Returns the title, which is assigned to the $my_month variable. The variable's value is then displayed with the PHP echo command.
Returns the title, which is assigned to the $my_month variable. The variable's value is then displayed with the PHP echo command.
返回标题,这个标签指定到$我的_月份 变数。变数的值,就会与PHP echo命令一起显示。


  <?php $my_month = single_month_title(&#39;&#39;, false); echo $my_month; ?>
  <?php $my_month = single_month_title(&#39;&#39;, false); echo $my_month; ?>


<?php $我的_月份 = 单个_月份_标题(&#39;&#39;, false); echo $我的_月份; ?>


== Parameters ==
== Parameters ==
==参数==


; prefix : (''string'') Text to place before the title. There is no default.
; prefix : (''string'') Text to place before the title. There is no default.
; display : (''boolean'') Display the title (<tt>TRUE</tt>), or return the title to be used in PHP (<tt>FALSE</tt>).  Defaults to <tt>TRUE</tt>.
; display : (''boolean'') Display the title (<tt>TRUE</tt>), or return the title to be used in PHP (<tt>FALSE</tt>).  Defaults to <tt>TRUE</tt>.
;前缀 : (''string'') 标题前显示的文本。没有默认设置。
; 显示 : (''boolean'') 显示标题(<tt>正确的</tt>), 或者将标题返回用于PHP(<tt>错误的</tt>)。 默认为 <tt>正确的</tt>。


== Related ==
== Related ==
第44行: 第80行:


{{PHP Function Tag Footer}}
{{PHP Function Tag Footer}}
== 相关的 ==
{{标签 日期 标签}}
{{PHP函数 标签 页底文字}}

2008年7月2日 (三) 15:15的版本

Description

描述

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). Note: This tag only works on date archive pages, not on category templates or others.

为当前网页显示月份和年份标题。只有WordPress将m或者归档月份argument传到当前的网页的时候(当浏览按月归档的网页的时候,就会出现这种情况),这个标签才会运行。注:这个标签只在日期归档网页上运行,不在类别模板或者其它的模板上运行。

Usage

%%% <?php single_month_title('prefix', display) ?> %%%

用法

%%% <?php 单个_月份_标题('前缀', 显示) ?> %%%

The generated title will be:

产生的标题会是:

prefix + MONTH + prefix + YEAR
前缀+月份+前缀+年份

If prefix parameter is '*', an example would be: 如果前缀参数是'*',例子就是:

*February*2004
  • 2004年*2月

Examples

Month and Year on New Lines

例子=

新的文本行中的年份和月份

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

在新的文本行中显示标题,放置年份和月份。

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

<p><?php 单个_月份_标题('<br />') ?></p>

December
2004


十二月
2004


Using $my_month Variable

使用 $我的_月份 变数

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

返回标题,这个标签指定到$我的_月份 变数。变数的值,就会与PHP echo命令一起显示。

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

<?php $我的_月份 = 单个_月份_标题('', false); echo $我的_月份; ?>

Parameters

参数

prefix
(string) Text to place before the title. There is no default.
display
(boolean) Display the title (TRUE), or return the title to be used in PHP (FALSE). Defaults to TRUE.
前缀
(string) 标题前显示的文本。没有默认设置。
显示
(boolean) 显示标题(正确的), 或者将标题返回用于PHP(错误的)。 默认为 正确的

Related

模板:Tag Date Tags

模板:PHP Function Tag Footer

相关的

模板:标签 日期 标签