WordPress at a glance

bloginfo() WP 0.71

Displays information about the current site.

Displays information about your site, mostly gathered from the information you supply in your User Profile and General Settings WordPress Administration Screens. It can be used anywhere within a template file. This always prints a result to the browser. If you need the values for use in PHP, use get_bloginfo().

For newbies

For those who do not know yet, I want to dispel the myth that getting data through this function leads to excessive load on the hosting. In fact, nothing of the sort! Once I thought so too, but after a series of tests I made sure that the load would be barely noticeable if through this function you get about 5 thousand data. Therefore, do not believe if someone says that bloginfo() or get_bloginfo() overload the server!

If you do not specify the $show parameter, the blog name will be displayed. If you specify not known values, the name of the blog will be displayed too.

Works based on: get_bloginfo()
✈ 1 time = 0.00021s = fast | 50000 times = 6.78s = fast

No Hooks.

Return

Nothing (null).

Usage

bloginfo( $show );
$show(string)

Site information to display. Possible values:

  • name - Site title.
  • description - Site description.
  • template_url - URL of the active theme’s directory.
  • stylesheet_url - Primary CSS (usually style.css) file URL of the active theme.
  • rss2_url - RSS 2.0 feed URL (/feed).
  • comments_rss2_url - Comments RSS 2.0 feed URL (/comments/feed).
  • pingback_url - Pingback XML-RPC file URL (xmlrpc.php).
  • charset - Charset encoding of the website. Note: This parameter always echoes UTF-8, which is the default encoding of WordPress.
  • version - WordPress Version you use.
  • html_type - Content-Type of WordPress HTML pages (default: “text/html”).
  • language - Language of WordPress, for example, en-US.
Rarely used:
  • stylesheet_directory - Stylesheet directory URL of the active theme. Better use get_stylesheet_directory_uri() instead.
  • template_directory - Stylesheet directory URL of the active theme. Better use get_template_directory() instead.
  • admin_email - “E-mail address” set in Settings > General.
  • rdf_url - RDF/RSS 1.0 feed URL (/feed/rfd).
  • rss_url - RSS 0.92 feed URL (/feed/rss).
  • atom_url - Atom feed URL (/feed/atom).
  • url - URL of the website (WordPress address (URL) in Settings > General). Same as home_url().
  • wpurl - WordPress URL (WordPress address (URL) in Settings > General). Same as site_url().
Deprecated:
  • home - Deprecated since version 2.2. Use home_url() instead.
  • siteurl - Deprecated since version 2.2. Use site_url() instead.

Default: ''

Examples

#1 Display website title in header

<h1><?php bloginfo('name'); ?></h1>

#2 Display website charset

<p>Charset: <?php bloginfo('charset'); ?> </p>

#3 Display website description

<p><?php bloginfo('description'); ?> </p>

Code of bloginfo: wp-includes/general-template.php WP 5.2.1

<?php
function bloginfo( $show = '' ) {
	echo get_bloginfo( $show, 'display' );
}

Related Functions

From category: Other Theme Functions

More from Template Tags: Main Functions

No comments
    Hello, !     Log In . Register