the_modified_date

函式
the_modified_date ( $format = '', $before = '', $after = '', $echo = true )
引數
  • (string) $format Optional. PHP date format. Defaults to the 'date_format' option.
    Required:
    Default: (empty)
  • (string) $before Optional. Output before the date. Default empty.
    Required:
    Default: (empty)
  • (string) $after Optional. Output after the date. Default empty.
    Required:
    Default: (empty)
  • (bool) $echo Optional. Whether to echo the date or return it. Default true.
    Required:
    Default: true
返回值
  • (string|void) String if retrieving.
定義位置
相關方法
get_the_modified_datethe_modified_timethe_modified_authorget_the_modified_timeget_the_modified_author
引入
2.1.0
棄用
-

the_modified_date – 這個函式用來輸出一個文章或頁面最後被修改的日期。

顯示文章最後一次被修改的日期。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function the_modified_date( $format = '', $before = '', $after = '', $echo = true ) {
$the_modified_date = $before . get_the_modified_date( $format ) . $after;
/**
* Filters the date a post was last modified for display.
*
* @since 2.1.0
*
* @param string|false $the_modified_date The last modified date or false if no post is found.
* @param string $format PHP date format.
* @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, $format, $before, $after );
if ( $echo ) {
echo $the_modified_date;
} else {
return $the_modified_date;
}
}
function the_modified_date( $format = '', $before = '', $after = '', $echo = true ) { $the_modified_date = $before . get_the_modified_date( $format ) . $after; /** * Filters the date a post was last modified for display. * * @since 2.1.0 * * @param string|false $the_modified_date The last modified date or false if no post is found. * @param string $format PHP date format. * @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, $format, $before, $after ); if ( $echo ) { echo $the_modified_date; } else { return $the_modified_date; } }
function the_modified_date( $format = '', $before = '', $after = '', $echo = true ) {
	$the_modified_date = $before . get_the_modified_date( $format ) . $after;

	/**
	 * Filters the date a post was last modified for display.
	 *
	 * @since 2.1.0
	 *
	 * @param string|false $the_modified_date The last modified date or false if no post is found.
	 * @param string       $format            PHP date format.
	 * @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, $format, $before, $after );

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

}

常見問題

FAQs
檢視更多 >