• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
WordPress core a2z

WordPress core a2z

WordPress core only

  • Home
  • Plugins
  • Blocks
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / APIs / the_title() – Display or retrieve the current post title with optional markup.

You appear to be a bot. Output may be restricted

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

Published: 25th November 2019 | Last updated: 25th November 2019

Primary Sidebar

Information

Function name: the_title
Plugin ref: WordPress
Version: 5.6.2
Sourcefile: wp-includes/post-template.php
File ref: wp-includes/post-template.php
Deprecated?: No
API Letters: T

Footer

WP-a2z
WordPress core a2z
WordPress core only
WordPress 5.6.2
WordPress a2z
WordPress core a2z
Genesis Theme Framework a2z
Jetpack a2z
WordPress develop tests
Easy Digital Downloads a2z
WooCommerce a2z
Yoast SEO a2z
WordPress Blocks

Site:  core.wp-a2z.org
© Copyright WP-a2z 2014-2021. All rights reserved.


Website designed and developed by Herb Miller
Proudly powered by WordPress and oik plugins

  • Home
  • Blog
  • Sitemap
  • Sites