WordPress V5.0+Template Tag Reference Guide as of Version 5.2
Presented by DBS > Interactive Development :
Blog Info Tags
Blog Infobloginfo();
Displays information about your blog, mostly gathered from the information you supply in your User Profile and General Options from the WordPress Administration panels (Settings > General). It can be used anywhere within a page template. This always prints a result to the browser. If you need the values for use in PHP, use get_bloginfo().
<?php bloginfo($show); ?>
Possible values of $show:
name
String • Defaults to this if $show isn't specified.
Returns the blog title set in Administration > Settings > General.
description
String
Returns the Tagline set in Administration > Settings > General.
admin_email
String
Returns the Administrator's E-mail address set in Administration > Settings > General.
url
String
The Blog address (URI) is the URL for your blog's web site address and is set in Administration > Settings > General.
wpurl
String
The WordPress address (URI) is the URL for your WordPress installation and is set in Administration > Settings > General
stylesheet_directory
String
Returns URL of the stylesheet directory of the active theme.
stylesheet_url
String
Returns URL for primary CSS file (usually style.css) of the active theme.
template_directory
String
Returns URL of the active theme's directory. (template_directory was a local path before 2.6; see get_theme_root() and get_template() for hackish alternatives.) Within child themes, both get_bloginfo("template_url") and get_template() will return the parent theme directory.
atom_url
String
Returns URL for the blog's Atom feed.
rss2_url
String
Returns URL for the blog's RSS 2.0 feed.
rss_url
String
Returns URL for the blog's RSS 0.92 feed.
pingback_url
String
Returns URL for Pingback XML-RPC file.
rdf_url
String
Returns URL for the blog's RDF/RSS 1.0 feed.
comments_atom_url
String
Returns URL for the blog's comments Atom feed.
comments_rss2_url
String
Returns URL for the blog's comments RSS 2.0 feed.
charset
String
Returns the Encoding for pages and feeds set in Administration > Settings > Reading.
html_type
String
Returns Content-Type of WordPress HTML pages (default: text/html); stored in the html_type record in the wp_options table. Themes and plugins can override the default value by using the pre_option_html_type filter.
language
String
Returns selected language.
text_direction
String
Returns selected direction.
version
String
Returns version of WordPress your blog uses.
Blog Info RSSbloginfo_rss();
Display RSS container for the bloginfo function. You are able to retrieve any blog / system related details that are available. Everything will be stripped of tags and characters converted, when the values are retrieved for use in the feeds.
<?php bloginfo_rss($show); ?>
$show
String • Default: 'name'
(Optional) See get_bloginfo() for possible values.
Get Admin URLget_admin_url();
Retrieve the url to the admin area for a given site, with optional path appended.
<?php get_admin_url($blog_id, $path, $scheme); ?>
$blog_id
Integer • Default: Current blog
(Optional) Blog ID.
$path
String • Default: ''
(Optional) Optional path relative to the admin url.
$scheme
String • Default: 'admin', which obeys force_ssl_admin() and is_ssl()
(Optional) The scheme to use. 'http' or 'https' can be passed to force those schemes.
Get Blog Infoget_bloginfo();
The get_bloginfo() function returns information about your blog which can then be used elsewhere in your PHP code. This function, as well as bloginfo(), can also be used to display your blog information.
<?php get_bloginfo($show) ?>
$show
String • Default: name.
(Optional) Keyword naming the information you want.
If you omit this parameter or pass any value besides those below, the function returns the blog title.
name
String
Returns the blog title set in Administration > Settings > General.
description
String
Returns the Tagline set in Administration > Settings > General.
url
String
The Blog address (URI) is the URL for your blog's web site address and is set in Administration > Settings > General.
wpurl
String
The WordPress address (URI) is the URL for your WordPress installation and is set in Administration > Settings > General
rdf_url
String
Returns URL for the blog's RDF/RSS 1.0 feed.
rss_url
String
Returns URL for the blog's RSS 0.92 feed.
rss2_url
String
Returns URL for the blog's RSS 2.0 feed.
atom_url
String
Returns URL for the blog's Atom feed.
comments_rss2_url
String
Returns URL for the blog's comments RSS 2.0 feed.
pingback_url
String
Returns URL for Pingback XML-RPC file.
stylesheet_url
String
Returns URL for primary CSS file (usually style.css) of the active theme.
template_directory
String
Returns URL of the active theme's directory. (template_directory was a local path before 2.6; see get_theme_root() and get_template() for hackish alternatives.) Within child themes, both get_bloginfo("template_url") and get_template() will return the parent theme directory.
template_url
String
Returns URL of the active theme's directory. (template_directory was a local path before 2.6; see get_theme_root() and get_template() for hackish alternatives.) Within child themes, both get_bloginfo("template_url") and get_template() will return the parent theme directory.
admin_email
String
Returns the Administrator's E-mail address set in Administration > Settings > General.
charset
String
Returns the Encoding for pages and feeds set in Administration > Settings > Reading.
version
String
Returns version of WordPress your blog uses.
html_type
String
Returns Content-Type of WordPress HTML pages (default: text/html); stored in the html_type record in the wp_options table. Themes and plugins can override the default value by using the pre_option_html_type filter.
Get Blog Info RSSget_bloginfo_rss();
RSS container for the bloginfo function. You are able to retrieve any blog / system related details that are available. Everything will be stripped of tags and characters converted, when the values are retrieved for use in the feeds.
<?php get_bloginfo_rss($show); ?>
$show
String • Default: 'name'
Informational detail about your blog. Valid values:
- 'name' - Blog title; set in General Options.
- 'description' - Tagline for your blog; set in General Options.
- 'url' - URL for your blog's web site address.
- 'rdf_url' - URL for RDF/RSS 1.0 feed.
- 'rss_url' - URL for RSS 0.92 feed.
- 'rss2_url' - URL for RSS 2.0 feed.
- 'atom_url' - URL for Atom feed.
- 'comments_rss2_url' - URL for comments RSS 2.0 feed.
- 'pingback_url' - URL for Pingback (XML-RPC file).
- 'admin_email' - Administrator's email address; set in General Options.
- 'charset' - Character encoding for your blog; set in Reading Options.
- 'version' - Version of WordPress your blog uses.
The following will work in WordPress version 1.5 or after:
- 'html_type' - "Content-type" for your blog.
- 'wpurl' - URL for WordPress installation.
- 'template_url' - URL for template in use.
- 'template_directory' - URL for template's directory.
- 'stylesheet_url' - URL for primary CSS file.
- 'stylesheet_directory' - URL for stylesheet directory.
Get Current Blog IDget_current_blog_id();
Retrieve the current blog id. Since WP 3.1.0
<?php get_current_blog_id(); ?>
No parameters.
Get Home URLget_home_url();
The get_home_url template tag retrieves the home url for a given site, with optional path appended. Returns the 'home' option with the appropriate protocol, 'https' if is_ssl() and 'http' otherwise. If scheme is 'http' or 'https', is_ssl() is overridden.
<?php get_home_url($blog_id, $path, $scheme); ?>
$blog_id
Integer • Default: Current blog
(Optional) Blog ID.
$path
String • Default: ''
(Optional) Optional path relative to the home url.
$scheme
String • Default: null
(Optional) The scheme to give the home url context. Currently 'http', 'https'.
Get Site URLget_site_url();
The get_site_url() template tag retrieves the site url for a given site, with optional path appended. Returns the 'siteurl' option with the appropriate protocol, 'https' if is_ssl() and 'http' otherwise. If $scheme is 'http' or 'https', is_ssl() is overridden.
<?php get_site_url($blog_id, $path, $scheme); ?>
$blog_id
Integer • Default: Current blog.
(Optional) Blog ID.
$path
String • Default: ''
(Optional) Optional path relative to the site url.
$scheme
String • Default: null
(Optional) The scheme to give the site url context. Currently 'http', 'https', 'login', 'login_post', or 'admin'.
Home URLhome_url();
The home_url template tag retrieves the home url, with optional path appended, for the current site with the appropriate protocol, 'https' if is_ssl() and 'http' otherwise. If scheme is 'http' or 'https', is_ssl() is overridden.
<?php home_url($path, $scheme); ?>
$path
String • Default: ''
(Optional) Optional path relative to the home url.
$scheme
String • Default: null
(Optional) The scheme to give the home url context. Currently 'http', 'https'.
Site URLsite_url();
The site_url template tag retrieves the site url for the current site with optional path appended (where the WordPress core files are) with the appropriate protocol, 'https' if is_ssl() and 'http' otherwise. If scheme is 'http' or 'https', is_ssl() is overridden. Use this to get the "wordpress address" as defined in general settings. (Use home_url() instead to get the "site address" as defined in general settings.)
<?php site_url($path, $scheme); ?>
$path
String • Default: ''
(Optional) Optional path relative to the site url.
$scheme
String • Default: null
(Optional) The scheme to give the site url context. Currently 'http', 'https', 'login', 'login_post', or 'admin'.