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 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>
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 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>
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>
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>
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选项中配置的日期格式。请看看日期和时间格式。