^ 回到顶部
  • 人生没有定律,每个人都有自己的节奏
  • 本站wordpress建站教程均通过实践后发布,希望对你有帮助,如果有代码出错,请联系站长解决
  • 希望你的坚持,都是因为热爱,而不是因为不甘心
  • 8年wordpress建站经验,5星服务品质
  • 那些不愿意让你吃亏的人,才是真正值得你深交的人,也是值得你付出时间的人
  • 阿里云2核2g仅需86元/年

wordpress函数the_modified_date()用法示例

the_modified_date( string $d = '',  string $before = '',  string $after = '',  bool $echo = true )

Display the date on which the post was last modified.


描述


参数

$d

(string)
(Optional)
PHP date format defaults to the date_format option if not specified.

新用户2核2g仅需86元/年    领取1153套模板    免费cdn流量包    ¥3188礼包

Default value: ''

$before

(string)
(Optional)
Output before the date.

Default value: ''

$after

(string)
(Optional)
Output after the date.

Default value: ''

$echo

(bool)
(Optional)
default is display. Whether to echo the date or return it.

Default value: true


返回值

(string|void) String if retrieving.


源代码

File: wp-includes/general-template.php

function the_modified_date( $d = '', $before = '', $after = '', $echo = true ) {
	$the_modified_date = $before . get_the_modified_date($d) . $after;

	/**
	 * Filters the date a post was last modified for display.
	 *
	 * @since 2.1.0
	 *
	 * @param string $the_modified_date The last modified date.
	 * @param string $d                 PHP date format. Defaults to 'date_format' option
	 *                                  if not specified.
	 * @param string $before            HTML output before the date.
	 * @param string $after             HTML output after the date.
	 */
	$the_modified_date = apply_filters( 'the_modified_date', $the_modified_date, $d, $before, $after );

	if ( $echo )
		echo $the_modified_date;
	else
		return $the_modified_date;

}

更新日志

Version 描述
2.1.0 Introduced.

相关函数

Uses

  • wp-includes/general-template.php:
    get_the_modified_date()
  • wp-includes/general-template.php:
    the_modified_date
  • wp-includes/plugin.php:
    apply_filters()

  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 date the post was last modified, using the Default date format setting (e.g. F j, Y) from Administration > Settings > General.

    
    <p><?php printf( __( 'Last modified: %s', 'textdomain' ), get_the_modified_date() ); ?></p>
    

    Last modified: December 2, 2006

  2. Date as Month Day, Year
    Displays the last modified date in the date format ‘F j, Y’ (ex: December 2, 2006).

    
    <div><?php printf( __( 'Last modified: %s', 'textdomain' ), get_the_modified_date( 'F j, Y' ) ); ?></div>
    

    Last modified: December 2, 2006

    Date and Time
    Displays the date and time.

    
    <p><?php printf( __( 'Modified: %1$s at  %2$s', 'textdomain' ),
    	get_the_modified_date( 'F j, Y' ) ),
    	get_the_modified_date( 'g:i a' )
    ); ?></p>
    

    Modified: December 2, 2006 at 10:36 pm

    Date with superscript or subscript number suffixes
    Displays the date with a superscript or subscript st, nd, rd or th after the day. Because characters from the alphabet are used to represent the date format types, each of the HTML tag characters need to be escaped using a back slash. Superscript HTML tag is <sup> and subscript is <sub>.

    
    <p><?php printf( __( 'Modified: %s', 'textdomain' ), get_the_modified_date('j\<\s\u\p\>S\<\/\s\u\p\> M Y') ); ?></p>
    

    Modified: 2nd Dec 2006

让小雨知道,这篇文章帮到了你
扫码关注微信公众号zs40086(微搜片)随时随地微信看片,抢先福利电影等你来

热门推荐

如有疑问,请前往问答中心反馈!

反馈