the_title()

action the_title( string $before = ”, string $after = ”, bool $display = true ): void|string

Hiển thị hoặc truy xuất tiêu đề bài viết hiện tại với đánh dấu tùy chọn.

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

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

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

	if ( $display ) {
		echo $title;
	} else {
		return $title;
	}
}
Ví dụ 1: In tiêu đề ra màn hình dưới dạng h3.
<?php the_title( '<h3>', '</h3>' ); ?>
<h3>[tieu-de]</h3>