WordPress.org

Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/single post title

Description

Displays or returns the title of the post when on a single post page (permalink page). This tag can be useful for displaying post titles outside The Loop.

Usage

 <?php single_post_title$prefix$display ); ?> 

Default Usage

 <?php single_post_title(); ?> 

Parameters

$prefix
(string) (optional) Text to place before the title.
Default: None
$display
(boolean) (optional) Should the title be displayed (TRUE) or returned for use in PHP (FALSE).
Default: TRUE

Example

<h2><?php single_post_title( 'Current post: ' ); ?></h2>
Current post: Single Post Title

Changelog

Since: 0.71

Source File

single_post_title() is located in wp-includes/general-template.php.

Related

See also index of Function Reference and index of Template Tags.