the_time

函式
the_time ( $format = '' )
引數
  • (string) $format Optional. Format to use for retrieving the time the post was written. Accepts 'G', 'U', or PHP date format. Defaults to the 'time_format' option.
    Required:
    Default: (empty)
定義位置
相關方法
the_titleget_the_timetouch_timethe_datethe_meta
引入
0.71
棄用
-

the_time: 這個函式用來顯示一個文章或頁面在當前WordPress時區的時間。它通常在The Loop中使用,並接受一個字串作為引數來格式化時間輸出。

顯示文章的寫作時間。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function the_time( $format = '' ) {
/**
* Filters the time a post was written for display.
*
* @since 0.71
*
* @param string $get_the_time The formatted time.
* @param string $format Format to use for retrieving the time the post
* was written. Accepts 'G', 'U', or PHP date format.
*/
echo apply_filters( 'the_time', get_the_time( $format ), $format );
}
function the_time( $format = '' ) { /** * Filters the time a post was written for display. * * @since 0.71 * * @param string $get_the_time The formatted time. * @param string $format Format to use for retrieving the time the post * was written. Accepts 'G', 'U', or PHP date format. */ echo apply_filters( 'the_time', get_the_time( $format ), $format ); }
function the_time( $format = '' ) {
	/**
	 * Filters the time a post was written for display.
	 *
	 * @since 0.71
	 *
	 * @param string $get_the_time The formatted time.
	 * @param string $format       Format to use for retrieving the time the post
	 *                             was written. Accepts 'G', 'U', or PHP date format.
	 */
	echo apply_filters( 'the_time', get_the_time( $format ), $format );
}

常見問題

FAQs
檢視更多 >