WordPress: Template Tags/the modified time:修订间差异

来自站长百科
跳转至: 导航、​ 搜索
(新页面: == Description == This tag displays the time (and date) a post was last modified and is similar to the functionality of the_time(), which displays th...)
 
无编辑摘要
第1行: 第1行:
== Description ==
== Description ==
== 描述 ==


This tag displays the time (and date) a post was last modified and is similar to the functionality of [[WordPress:Template_Tags/the_time|the_time()]], which displays the time (and date) a post was created.  This tag must be used within [[WordPress:The Loop]].  If no format parameter is specified, the '''Default date format''' (please note that says Date format) setting from [[WordPress:Administration_Panels|Administration]] > [[WordPress:Administration_Panels#General|Settings]] > [[WordPress:Settings_General_SubPanel|General]] is used for the display format.
This tag displays the time (and date) a post was last modified and is similar to the functionality of [[WordPress:Template_Tags/the_time|the_time()]], which displays the time (and date) a post was created.  This tag must be used within [[WordPress:The Loop]].  If no format parameter is specified, the '''Default date format''' (please note that says Date format) setting from [[WordPress:Administration_Panels|Administration]] > [[WordPress:Administration_Panels#General|Settings]] > [[WordPress:Settings_General_SubPanel|General]] is used for the display format.
这个标签显示了文章最后一次更改的时间(和日期),而且与[[WordPress:Template_Tags/the_time|the_时间()]]的功能类似,后者显示了文章创建时的时间(和日期)。必须在[[WordPress:The Loop|The Loop]]内使用这个标签。如果没有规定格式参数,[[WordPress:Administration_Panels|管理]] > [[WordPress:Administration_Panels#General|设置]] > [[WordPress:Settings_General_SubPanel|总的]]中的'''默认日期格式'''(请注意是日期格式的设置)被用来显示格式。


If the post or page is not yet modified, the modified time is the same as the creation time.
If the post or page is not yet modified, the modified time is the same as the creation time.
如果没有任何的文章或者网页经过了修改,那么修改时间仍然与创建时间相同。


If you want to display both the modified time and the creation time, you may want to use an <tt>if</tt> statement (e.g. <tt>if (get_the_modified_time() != get_the_time())</tt>) to avoid showing the same time/date twice.
If you want to display both the modified time and the creation time, you may want to use an <tt>if</tt> statement (e.g. <tt>if (get_the_modified_time() != get_the_time())</tt>) to avoid showing the same time/date twice.
   
   
如果你想要显示更改的时间和创建的时间。你可能要使用一个<tt>如果</tt> 声明 (例如 <tt>如果(得到_the_更改的_时间() != 得到_the_时间())</tt>)避免两次显示同样的时间/日期。
== Usage ==
== Usage ==


%%% <?php the_modified_time('d'); ?> %%%
%%% <?php the_modified_time('d'); ?> %%%
== 用法e ==
%%% <?php the_更改的_时间('d'); ?> %%%


== Examples ==
== Examples ==


=== Default Usage ===
=== Default Usage ===
== 例子 ==
=== 默认用法 ===


Displays the time (date) the post was last modified, using the '''Default date format''' setting (e.g. F j, Y) from [[WordPress:Administration_Panels|Administration]] > [[WordPress:Administration_Panels#General|Settings]] > [[WordPress:Settings_General_SubPanel|General]].
Displays the time (date) the post was last modified, using the '''Default date format''' setting (e.g. F j, Y) from [[WordPress:Administration_Panels|Administration]] > [[WordPress:Administration_Panels#General|Settings]] > [[WordPress:Settings_General_SubPanel|General]].
使用[[WordPress:Administration_Panels|管理]] > [[WordPress:Administration_Panels#General|设置]] > [[WordPress:Settings_General_SubPanel|总的]]中的'''默认日期格式''' 设置 (例如 F j, Y),显示文章最后一次更改的时间(日期)。


  &lt;p&gt;Last modified: <?php the_modified_time(); ?>&lt;/p&gt;
  &lt;p&gt;Last modified: <?php the_modified_time(); ?>&lt;/p&gt;
&lt;p&gt;最后更改的: <?php the_更改的_时间(); ?>&lt;/p&gt;


<div style="border:1px solid blue; width:50%; padding:10px">Last modified: December 2, 2006</div>
<div style="border:1px solid blue; width:50%; padding:10px">Last modified: December 2, 2006</div>
<div style="border:1px solid blue; width:50%; padding:10px">最后更改的: 2006年12月2日</div>


=== Time in the 12-hour format (am/pm)===
=== Time in the 12-hour format (am/pm)===
=== 12时制的时间格式(上午/下午)===


If a post was modified at 10:36pm, this example displays the time the post was last modified using the 12-hour format parameter string <tt>'g:i a'</tt>.
If a post was modified at 10:36pm, this example displays the time the post was last modified using the 12-hour format parameter string <tt>'g:i a'</tt>.
如果一篇文章是在下午10:36分更改的,这个例子使用12时制的参数字符串<tt>'g:i a'</tt>显示文章最后更改的时间。


  &lt;p&gt;Time last modified: <?php the_modified_time('g:i a'); ?>&lt;/p&gt;
  &lt;p&gt;Time last modified: <?php the_modified_time('g:i a'); ?>&lt;/p&gt;
&lt;p&gt;最后更改的时间: <?php the_最后更改的_时间('g:i a'); ?>&lt;/p&gt;


<div style="border:1px solid blue; width:50%; padding:10px">Time last modified: 10:36 pm</div>
<div style="border:1px solid blue; width:50%; padding:10px">Time last modified: 10:36 pm</div>
<div style="border:1px 固体蓝; width:50%; padding:10px">最后更改的时间: 下午10:36 </div>


=== Time in the 24-hour format ===
=== Time in the 24-hour format ===
=== 24时制的时间格式===
If a post was modified at 10:36pm, this example displays the time the post was last modified using the 24-hour format parameter string <tt>'G:i'</tt>.
If a post was modified at 10:36pm, this example displays the time the post was last modified using the 24-hour format parameter string <tt>'G:i'</tt>.
如果文章最后一次更改的时间是下午10:36,这个例子使用24时制的格式string <tt>'G:i'</tt>显示文章最后一次更改的时间。


  &lt;p&gt;Time last modified: <?php the_modified_time('G:i'); ?>&lt;/p&gt;
  &lt;p&gt;Time last modified: <?php the_modified_time('G:i'); ?>&lt;/p&gt;
&lt;p&gt;最后一次更改的时间: <?php the_更改的_时间('G:i'); ?>&lt;/p&gt;


<div style="border:1px solid blue; width:50%; padding:10px">Time last modified: 22:36</div>
<div style="border:1px solid blue; width:50%; padding:10px">Time last modified: 22:36</div>
<div style="border:1px solid blue; width:50%; padding:10px">最后一次更改的时间: 22:36</div>


=== Date as Month Day, Year ===
=== Date as Month Day, Year ===
=== 按年,月,日排列日期===


Displays the last modified time and date in the date format <tt>'F j, Y'</tt> (ex: December 2, 2006), which could be used to replace the tag [[WordPress:Template_Tags/the_modified_date|the_modified_date()]].  
Displays the last modified time and date in the date format <tt>'F j, Y'</tt> (ex: December 2, 2006), which could be used to replace the tag [[WordPress:Template_Tags/the_modified_date|the_modified_date()]].  
以日期格式<tt>'F j, Y'</tt>显示最后一次更改的时间和日期(例如: 2006年12月2日),可以用来代替标签[[WordPress:Template_Tags/the_modified_date|the_更改的_日期()]]。


  &lt;div&gt;Last modified: <?php the_modified_time('F j, Y'); ?>&lt;/div&gt;
  &lt;div&gt;Last modified: <?php the_modified_time('F j, Y'); ?>&lt;/div&gt;
&lt;div&gt;最后更改的: <?php the_modified_time('F j, Y'); ?>&lt;/div&gt;


<div style="border:1px solid blue; width:50%; padding:10px">Last modified: December 2, 2006</div>
<div style="border:1px solid blue; width:50%; padding:10px">Last modified: December 2, 2006</div>
<div style="border:1px 固体蓝; width:50%; padding:10px">最后更改的: 2006年12月2日</div>


=== Date and Time ===
=== Date and Time ===
=== 日期和时间===


Displays the date and time.
Displays the date and time.
显示日期和时间。


  &lt;p&gt;Modified: <?php the_modified_time('F j, Y'); ?> at <?php the_modified_time('g:i a'); ?>&lt;/p&gt;
  &lt;p&gt;Modified: <?php the_modified_time('F j, Y'); ?> at <?php the_modified_time('g:i a'); ?>&lt;/p&gt;
&lt;p&gt;更改的: <?php the_更改的_时间('F j, Y'); ?> at <?php the_更改的_时间('g:i a'); ?>&lt;/p&gt;


<div style="border:1px solid blue; width:50%; padding:10px">Modified: December 2, 2006 at 10:36 pm</div>
<div style="border:1px solid blue; width:50%; padding:10px">Modified: December 2, 2006 at 10:36 pm</div>
<div style="border:1px solid blue; width:50%; padding:10px">更改的: 2006年12月2日下午 10:36 </div>


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


; d : (''string'') The format the time is to display in.  Defaults to the date format configured in your WordPress options.  See [[WordPress:Formatting Date and Time]].
; d : (''string'') The format the time is to display in.  Defaults to the date format configured in your WordPress options.  See [[WordPress:Formatting Date and Time]].
; d : (''string'')时间显示的格式。默认为WordPress选项中配置的日期格式。请看看[[WordPress:Formatting Date and Time|日期和时间格式]]。


== Related ==
== Related ==
第61行: 第118行:


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

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

Description

描述

This tag displays the time (and date) a post was last modified and is similar to the functionality of the_time(), which displays the time (and date) a post was created. This tag must be used within WordPress:The Loop. If no format parameter is specified, the Default date format (please note that says Date format) setting from Administration > Settings > General is used for the display format.

这个标签显示了文章最后一次更改的时间(和日期),而且与the_时间()的功能类似,后者显示了文章创建时的时间(和日期)。必须在The Loop内使用这个标签。如果没有规定格式参数,管理 > 设置 > 总的中的默认日期格式(请注意是日期格式的设置)被用来显示格式。

If the post or page is not yet modified, the modified time is the same as the creation time.

如果没有任何的文章或者网页经过了修改,那么修改时间仍然与创建时间相同。

If you want to display both the modified time and the creation time, you may want to use an if statement (e.g. if (get_the_modified_time() != get_the_time())) to avoid showing the same time/date twice.

如果你想要显示更改的时间和创建的时间。你可能要使用一个如果 声明 (例如 如果(得到_the_更改的_时间() != 得到_the_时间()))避免两次显示同样的时间/日期。

Usage

%%% <?php the_modified_time('d'); ?> %%%

用法e

%%% <?php the_更改的_时间('d'); ?> %%%

Examples

Default Usage

例子

默认用法

Displays the time (date) the post was last modified, using the Default date format setting (e.g. F j, Y) from Administration > Settings > General.

使用管理 > 设置 > 总的中的默认日期格式 设置 (例如 F j, Y),显示文章最后一次更改的时间(日期)。

<p>Last modified: <?php the_modified_time(); ?></p>

<p>最后更改的: <?php the_更改的_时间(); ?></p>

Last modified: December 2, 2006
最后更改的: 2006年12月2日

Time in the 12-hour format (am/pm)

12时制的时间格式(上午/下午)

If a post was modified at 10:36pm, this example displays the time the post was last modified using the 12-hour format parameter string 'g:i a'.

如果一篇文章是在下午10:36分更改的,这个例子使用12时制的参数字符串'g:i a'显示文章最后更改的时间。

<p>Time last modified: <?php the_modified_time('g:i a'); ?></p>

<p>最后更改的时间: <?php the_最后更改的_时间('g:i a'); ?></p>

Time last modified: 10:36 pm
最后更改的时间: 下午10:36

Time in the 24-hour format

24时制的时间格式

If a post was modified at 10:36pm, this example displays the time the post was last modified using the 24-hour format parameter string 'G:i'.

如果文章最后一次更改的时间是下午10:36,这个例子使用24时制的格式string 'G:i'显示文章最后一次更改的时间。

<p>Time last modified: <?php the_modified_time('G:i'); ?></p>

<p>最后一次更改的时间: <?php the_更改的_时间('G:i'); ?></p>

Time last modified: 22:36
最后一次更改的时间: 22:36

Date as Month Day, Year

按年,月,日排列日期

Displays the last modified time and date in the date format 'F j, Y' (ex: December 2, 2006), which could be used to replace the tag the_modified_date().

以日期格式'F j, Y'显示最后一次更改的时间和日期(例如: 2006年12月2日),可以用来代替标签the_更改的_日期()

<div>Last modified: <?php the_modified_time('F j, Y'); ?></div>

<div>最后更改的: <?php the_modified_time('F j, Y'); ?></div>

Last modified: December 2, 2006
最后更改的: 2006年12月2日

Date and Time

日期和时间

Displays the date and time. 显示日期和时间。

<p>Modified: <?php the_modified_time('F j, Y'); ?> at <?php the_modified_time('g:i a'); ?></p>

<p>更改的: <?php the_更改的_时间('F j, Y'); ?> at <?php the_更改的_时间('g:i a'); ?></p>

Modified: December 2, 2006 at 10:36 pm
更改的: 2006年12月2日下午 10:36

Parameters

参数

d
(string) The format the time is to display in. Defaults to the date format configured in your WordPress options. See WordPress:Formatting Date and Time.
d
(string)时间显示的格式。默认为WordPress选项中配置的日期格式。请看看日期和时间格式

Related

模板:Tag Date Tags

模板:Tag Footer

相关的

模板:标签 日期 标签