Getting started with WordPressget_bloginfo()Enqueuing scriptsMaking network requests with HTTP APIEnqueuing Styleshome_url()Custom Post Typestemplate_includeThe Loop (main WordPress loop)AJAXThe $wpdb ObjectActions and Filterswp_get_current_user()Add/remove contact info for users with user_contactmethods filter hookCreating a custom templateCustomizer Hello WorldCustomizer Basics (Add Panel, Section, Setting, Control)The Admin Bar (aka "The Toolbar")Querying postsAlternating main loop (pre_get_posts filter)ShortcodeCreate a Post Programmaticallyget_template_part()Taxonomiesget_template_part()ShortcodesPost FormatsCustom exerpts with excerpt_length and excerpt_morePlugin developmentSecurity in WordPress - EscapingTemplate hierarchyRemove Version from Wordpress and StylesheetsChild Theme Basicsadd_action()get_template_part()Shortcode with attributeSidebarsSecurity in WordPress - SanitizationinitCreate Template for Custom Post TypeFunction: add_action()Add ShortcodeHow Can I integrate Markdown editor with Advance Custom Field's repeater Add-on.Installation and Configurationwp_get_current_user()WP-CronSecure your installationOptions APIFunction : wp_trim_words()WP_Query() LoopUpdate WordPress ManuallyThemesWP-CLIDebuggingadd_menu_page()add_submenu_page()get_option()get_permalink()get_the_category()the_title()get_the_title()add_editor_style()add_theme_support()WordPress Plugin creationRun WordPress local with XAMPPAdmin Dashboard WidgetsSite MigrationMeta BoxRemove Auto Line Breaks From Content and Excerptget_home_path()Wordpress theme and child-theme developmentREST API

get_bloginfo()

Other topics

Remarks:

$show

ValuesDescriptionExample
'name' (Default)Site title'Matt Mullenweg'
'description'Site tagline'Just another WordPress site'
'wpurl'URL of the WordPress installation. Same as the site_url() function'http://example.com' , 'http://localhost/wordpress'
'url'URL of the site. Same as the home_url() function'http://example.com' , 'http://localhost/wordpress'
'admin_email'Email address of the main Administrator'[email protected]'
'charset'Character encoding of the pages and feeds'UTF-8'
'version'Current version of the WordPress installation'4.5'
'html_type'content-type value of the HTML'text/html'
'text_direction'Text direction determined by the site’s language'ltr'
'language'ISO 639-1 based language code'en-US'
'stylesheet_url'URL of the stylesheet of the activated theme. Value priority: Child theme » Parent theme.'http://example.com/wp-content/themes/twentysixteen/style.css'
'stylesheet_directory'Resource location of the activated theme. Value priority: Child theme » Parent theme.'http://example.com/wp-content/themes/twentysixteen'
'template_url'URL directory of the activated theme. Value priority: Parent theme » Child theme.'http://example.com/wp-content/themes/twentysixteen'
'template_directory'Same as 'template_url'
'pingback_url'Pingback XML-RPC file'http://example/xmlrpc.php'
'atom_url'Atom feed URL'http://example/feed/atom/'
'rdf_url'RDF/RSS 1.0 feed URL'http://example/feed/rdf/'
'rss_url'RSS 0.92 feed URL'http://example/feed/rss/'
'rss2_url'RSS 2.0 feed URL'http://example/feed/'
'comments_atom_url'Comments Atom feed URL'http://example/comments/feed/atom/'
'siteurl'(deprecated) Use ‘url’ instead
'home'(deprecated) Use ‘url’ instead

$filter

ValuesDescriptionExample
'raw' (Default)No filters will be appliedraw data
'display'Filters will be applied to the return value if $show is neither 'url' , 'directory' , 'home'filtered data

Getting the site title

<?php echo get_bloginfo( 'name' ); ?>

or

<?php echo get_bloginfo(); ?>

Output

Matt Mullenweg

Based on these sample settings

enter image description here

Getting the site tagline

<?php echo get_bloginfo( 'description' ); ?>

Output

Just another WordPress site

Based on these sample settings

enter image description here

Getting the active theme URL

<?php echo esc_url( get_bloginfo( 'stylesheet_directory' ) ); ?>

Output

http://example.com/wp-content/themes/twentysixteen

Alternatives

Internally, get_bloginfo( 'stylesheet_directory' ) calls get_stylesheet_directory_uri(), so you may want to use that instead:

<?php echo esc_url( get_stylesheet_directory_uri() ); ?>

Many developers prefer to use these dedicated functions because of inconsistent naming conventions between them and get_bloginfo(). For example, get_stylesheet_directory() returns the child theme path; however, as our previous example illustrates, get_bloginfo( 'stylesheet_directory' ) returns the child theme URL. If you use get_stylesheet_directory_uri() instead, there's less chance of confusion over whether you're retrieving a path or a URL.

Get site url

<?php echo esc_url(get_bloginfo('url')); ?>

or if you needed to link to a sub page

<?php echo esc_url(get_bloginfo('url') . '/some-sub-page');  ?>

Get Email Address of Site Administrator

We can use the get_bloginfo function to retrieve the email address of the site administrator.

<?php echo get_bloginfo('admin_email'); ?>

Syntax:

  • get_bloginfo( $show , $filter )

Parameters:

ParameterDetails
$show(string) The site setting information to retrieve.
$filter(string) The specification on whether to return a filtered value or not.

Contributors

Topic Id: 524

Example Ids: 1707,1708,1948,21778,25546

This site is not affiliated with any of the contributors.