WordPress.org

Ready to get started?Download WordPress

Codex

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

Function Reference/the title

Description

Displays or returns the title of the current post. This tag may only be used within The Loop, to get the title of a post outside of the loop use get_the_title. If the post is protected or private, this will be noted by the words "Protected: " or "Private: " prepended to the title.

Usage

 <?php the_title$before$after$echo ); ?> 

Parameters

$before
(string) (optional) Text to place before the title.
Default: None
$after
(string) (optional) Text to place after the title.
Default: None
$echo
(Boolean) (optional) Display the title (TRUE) or return it for use in PHP (FALSE).
Default: TRUE

Example

<?php the_title( '<h3>', '</h3>' ); ?>

This would print the title to the screen as an h3.

Notes

Change Log

Since: 0.71

Source File

the_title() is located in wp-includes/post-template.php.

Related

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