WordPress开发者和主题制作者的搜索引擎



the_title ›

Since0.71
已弃用n/a
the_title ( $before = '', $after = '', $echo = true )
参数: (3)
  • (string) $before Optional. Markup to prepend to the title. Default empty.
    Required: No
    默认: (empty)
  • (string) $after Optional. Markup to append to the title. Default empty.
    Required: No
    默认: (empty)
  • (bool) $echo Optional. Whether to echo or return the title. Default true for echo.
    Required: No
    默认: true
返回:
  • (string|void) Current post title if $echo is false.
定义在:
文档:

Display or retrieve the current post title with optional markup.



源码

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;
	}
}