the_title() – Display or retrieve the current post title with optional markup.

Description

Display or retrieve the current post title with optional markup.

Usage

$void|string = the_title( $before, $after, $echo );

Parameters

$before
( string ) optional – Optional. Markup to prepend to the title. Default empty.
$after
( string ) optional – Optional. Markup to append to the title. Default empty.
$echo
( bool ) optional default: 1 – Optional. Whether to echo or return the title. Default true for echo.

Returns

void|string Void if $echo argument is true, current post title if $echo is false.

Source

File name: wordpress/wp-includes/post-template.php
Lines:

1 to 15 of 15
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;
  }
}
 

 View on GitHub View on Trac

Called by

    Invoked by

      Calls

      Call hooks

      API Letters: