function the_title($before = '', $after = '', $echo = true) {}

Display or retrieve the current post title with optional content.


  • string $before: Optional. Content to prepend to the title.
  • string $after: Optional. Content to append to the title.
  • bool $echo: Optional, default to true.Whether to display or return.

Return values

returns:Null on no title. String if $echo parameter is false.

Source code

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

	$title = get_the_title();

	if ( strlen($title) == 0 )


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

	if ( $echo )

		echo $title;


		return $title;



No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: