get_bloginfo

Definition:
function get_bloginfo( $show = '', $filter = 'raw' ) {}

Retrieve information about the blog.
Some show parameter values are deprecated and will be removed in future versions. These options will trigger the _deprecated_argument() function. The deprecated blog info options are listed in the function contents.

Parameters

  • string $show: Blog info to retrieve.
  • string $filter: How to filter what is retrieved.

Return values

returns:Mostly string values, might be empty.

Defined filters

  • bloginfo_url
    apply_filters('bloginfo_url', $output, $show)
  • bloginfo
    apply_filters('bloginfo', $output, $show)

Source code

function get_bloginfo( $show = '', $filter = 'raw' ) {



	switch( $show ) {

		case 'home' : // DEPRECATED

		case 'siteurl' : // DEPRECATED

			_deprecated_argument( __FUNCTION__, '2.2', sprintf( __('The <code>%s</code> option is deprecated for the family of <code>bloginfo()</code> functions.' ), $show ) . ' ' . sprintf( __( 'Use the <code>%s</code> option instead.' ), 'url'  ) );

		case 'url' :

			$output = home_url();

			break;

		case 'wpurl' :

			$output = site_url();

			break;

		case 'description':

			$output = get_option('blogdescription');

			break;

		case 'rdf_url':

			$output = get_feed_link('rdf');

			break;

		case 'rss_url':

			$output = get_feed_link('rss');

			break;

		case 'rss2_url':

			$output = get_feed_link('rss2');

			break;

		case 'atom_url':

			$output = get_feed_link('atom');

			break;

		case 'comments_atom_url':

			$output = get_feed_link('comments_atom');

			break;

		case 'comments_rss2_url':

			$output = get_feed_link('comments_rss2');

			break;

		case 'pingback_url':

			$output = get_option('siteurl') .'/xmlrpc.php';

			break;

		case 'stylesheet_url':

			$output = get_stylesheet_uri();

			break;

		case 'stylesheet_directory':

			$output = get_stylesheet_directory_uri();

			break;

		case 'template_directory':

		case 'template_url':

			$output = get_template_directory_uri();

			break;

		case 'admin_email':

			$output = get_option('admin_email');

			break;

		case 'charset':

			$output = get_option('blog_charset');

			if ('' == $output) $output = 'UTF-8';

			break;

		case 'html_type' :

			$output = get_option('html_type');

			break;

		case 'version':

			global $wp_version;

			$output = $wp_version;

			break;

		case 'language':

			$output = get_locale();

			$output = str_replace('_', '-', $output);

			break;

		case 'text_direction':

			//_deprecated_argument( __FUNCTION__, '2.2', sprintf( __('The <code>%s</code> option is deprecated for the family of <code>bloginfo()</code> functions.' ), $show ) . ' ' . sprintf( __( 'Use the <code>%s</code> function instead.' ), 'is_rtl()'  ) );

			if ( function_exists( 'is_rtl' ) ) {

				$output = is_rtl() ? 'rtl' : 'ltr';

			} else {

				$output = 'ltr';

			}

			break;

		case 'name':

		default:

			$output = get_option('blogname');

			break;

	}



	$url = true;

	if (strpos($show, 'url') === false &&

		strpos($show, 'directory') === false &&

		strpos($show, 'home') === false)

		$url = false;



	if ( 'display' == $filter ) {

		if ( $url )

			$output = apply_filters('bloginfo_url', $output, $show);

		else

			$output = apply_filters('bloginfo', $output, $show);

	}



	return $output;

}

1200

get_blogaddress_by_name

Definition:
function get_blogaddress_by_name( $blogname ) {}

Get a full blog URL, given a blog name.

Parameters

  • string $blogname: The (subdomain or directory) name

Source code

function get_blogaddress_by_name( $blogname ) {

	global $current_site;



	if ( is_subdomain_install() ) {

		if ( $blogname == 'main' )

			$blogname = 'www';

		$url = rtrim( network_home_url(), '/' );

		if ( !empty( $blogname ) )

			$url = preg_replace( '|^([^\.]+://)|', '$1' . $blogname . '.', $url );

	} else {

		$url = network_home_url( $blogname );

	}

	return esc_url( $url . '/' );

}

1198

get_blogaddress_by_id

Definition:
function get_blogaddress_by_id( $blog_id ) {}

Get a full blog URL, given a blog id.

Parameters

  • int $blog_id: Blog ID

Source code

function get_blogaddress_by_id( $blog_id ) {

	$bloginfo = get_blog_details( (int) $blog_id, false ); // only get bare details!

	return esc_url( 'http://' . $bloginfo->domain . $bloginfo->path );

}

1196

get_blogaddress_by_domain

Definition:
function get_blogaddress_by_domain( $domain, $path ) {}

Get a full blog URL, given a domain and a path.

Parameters

  • string $domain
  • string $path

Source code

function get_blogaddress_by_domain( $domain, $path ) {

	if ( is_subdomain_install() ) {

		$url = "http://" . $domain.$path;

	} else {

		if ( $domain != $_SERVER['HTTP_HOST'] ) {

			$blogname = substr( $domain, 0, strpos( $domain, '.' ) );

			$url = 'http://' . substr( $domain, strpos( $domain, '.' ) + 1 ) . $path;

			// we're not installing the main blog

			if ( $blogname != 'www.' )

				$url .= $blogname . '/';

		} else { // main blog

			$url = 'http://' . $domain . $path;

		}

	}

	return esc_url( $url );

}

1194

get_background_image

Definition:
function get_background_image() {}

Retrieve background image for custom background.

Source code

function get_background_image() {

	$default = defined('BACKGROUND_IMAGE') ? BACKGROUND_IMAGE : '';



	return get_theme_mod('background_image', $default);

}

1192