the_title() – Displays or retrieves the current post title with optional markup.

You appear to be a bot. Output may be restricted

Description

Displays or retrieves the current post title with optional markup.

Usage

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

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.
$display
( bool ) optional default: 1 – Optional. Whether to echo or return the title. Default true for echo.

Returns

void|string Void if $display argument is true or the title is empty, current post title if $display is false.

Source

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


Lines:

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

 View on GitHub View on Trac