the_title

函式
the_title ( $before = '', $after = '', $echo = true )
引數
  • (string) $before Optional. Markup to prepend to the title. Default empty.
    Required:
    Default: (empty)
  • (string) $after Optional. Markup to append to the title. Default empty.
    Required:
    Default: (empty)
  • (bool) $echo Optional. Whether to echo or return the title. Default true for echo.
    Required:
    Default: true
返回值
  • (void|string) Void if `$echo` argument is true, current post title if `$echo` is false.
定義位置
相關方法
the_title_rssthe_timeget_the_titlethe_datewp_title
引入
0.71
棄用
-

the_title: 這個函式顯示當前文章或頁面的標題。它通常在The Loop中使用,可以用來顯示文章或頁面的連結,標題是連結的文字。

顯示或檢索當前文章的標題,並帶有可選標記。

function the_title( $before = '', $after = '', $echo = true ) {
	$title = get_the_title();

	if ( strlen( $title ) == 0 ) {
		return;
	}

	$title = $before . $title . $after;

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

常見問題

FAQs
檢視更多 >