WordPress V5.0+Template Tag Reference Guide as of Version 5.2
Presented by DBS > Interactive Development :
Title Tags
Get Search Queryget_search_query();
Displays the search query for the current request, if a search was made. This function can be used safely within HTML attributes (as in the "search box" example, below).
<?php get_search_query($escaped); ?>
$escaped
Boolean • Default: true
(Optional) Whether the result is escaped. Only use when you are later escaping it. Do not use unescaped.
Single Cat Titlesingle_cat_title();
Displays or returns the category title for the current page. For pages displaying WordPress tags rather than categories (e.g. "/tag/geek") the name of the tag is displayed instead of the category. Can be used only outside The Loop.
<?php single_cat_title($prefix, $display); ?>
$prefix
String • Default: none
(Optional) Text to output before the title.
$display
Boolean • Default: true
(Optional) Should the title be displayed (true) or returned for use in PHP (false).
Single Month Titlesingle_month_title();
Displays or returns the month and year title for the current page. This tag only works when the m or archive month argument has been passed by WordPress to the current page (this occurs when viewing a monthly archive page). Note: This tag works only on date archive pages, not on category templates or others. It does not support placing the separator after the title, but by leaving the prefix parameter empty, you can set the title separator manually. The prefix does not automatically place a space between the prefix, so if there should be a space, the parameter value will need to have it at the end.
<?php single_month_title($prefix, $display); ?>
$prefix
String • Default: none
(Optional) Text to output before the title.
$display
Boolean • Default: true
(Optional) Should the title be displayed (true) or returned for use in PHP (false).
Single Post Titlesingle_post_title();
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.
<?php single_post_title($prefix, $display); ?>
$prefix
String • Default: none
(Optional) Text to output before the title.
$display
Boolean • Default: true
(Optional) Should the title be displayed (true) or returned for use in PHP (false).
Single Tag Titlesingle_tag_title();
Displays or returns the tag title for the current page.
<?php single_tag_title($prefix, $display); ?>
$prefix
String • Default: none
(Optional) Text to output before the title.
$display
Boolean • Default: true
(Optional) Should the title be displayed (true) or returned for use in PHP (false).
The Search Querythe_search_query();
Displays the search query for the current request, if a search was made. This function can be used safely within HTML attributes (as in the "search box" example, below).
<?php the_search_query(); ?>
No parameters.
WP Titlewp_title();
Displays or returns the title of the page. A separator string can be defined, and beginning with Version 2.5, that separator can be designated to print before or after the title of the page. This tag can be used anywhere within a template as long as it's outside The Loop on the main page, though is typically used in the <title> element for the head of a page.
<?php wp_title($sep, $echo, $seplocation); ?>
$sep
String • Default: » (»)
(Optional) Text to display before or after of the post title (i.e. the separator). By default (if sep is blank) then the » (») symbol will be placed before or after (specified by the seplocation) the post title.
$echo
Boolean • Default: true
(Optional) Echo the title (true) or return the title for use as a PHP string (false).
$seplocation
String • Default: none
(Optional) Introduced with Version 2.5, this parameter defines the location of where the sep string prints in relation to the title of the post. For all values except 'right', the sep value is placed in front of (to the left of) the post title. If the value of seplocation is 'right' then the sep string will be appended after the post title.