返回介绍

the_modified_time()

发布于 2017-09-11 10:36:06 字数 4364 浏览 1133 评论 0 收藏 0

the_modified_time( string $d = '' )

Display the time at which the post was last modified.


description


参数

$d

(string) (Optional) Either 'G', 'U', or php date format defaults to the value specified in the time_format option.

Default value: ''


源代码

File: wp-includes/general-template.php

function the_modified_time($d = '') {
	/**
	 * Filters the localized time a post was last modified, for display.
	 *
	 * @since 2.0.0
	 *
	 * @param string $get_the_modified_time The formatted time.
	 * @param string $d                     The time format. Accepts 'G', 'U',
	 *                                      or php date format. Defaults to value
	 *                                      specified in 'time_format' option.
	 */
	echo apply_filters( 'the_modified_time', get_the_modified_time($d), $d );
}

更新日志

Versiondescription
2.0.0Introduced.

相关函数

Uses

  • wp-includes/general-template.php: get_the_modified_time()
  • wp-includes/general-template.php: the_modified_time
  • wp-includes/plugin.php: apply_filters()

User Contributed Notes

  1. Skip to note content You must log in to vote on the helpfulness of this noteVote results for this note: 0You must log in to vote on the helpfulness of this note Contributed by Codex

    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.

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

    Output is “Last modified: December 2, 2006”

  2. Time in the 12-hour format (am/pm)
    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’.

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

    Output is “Time last modified: 10:36 pm”

    Time in the 24-hour format

    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’.

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

    Output is “Time last modified: 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().

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

    Output is “Last modified: December 2, 2006”.

    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().

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

    Output is “Last modified: December 2, 2006”.

    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>
    

    Output is “Modified: December 2, 2006 at 10:36 pm”.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文