size_format

Definition:
function size_format( $bytes, $decimals = 0 ) {}

Convert number of bytes largest unit bytes will fit into.
It is easier to read 1kB than 1024 bytes and 1MB than 1048576 bytes. Converts number of bytes to human readable number by taking the number of that unit that the bytes will go into it. Supports TB value.

Parameters

  • int|string $bytes: Number of bytes. Note max integer size for integers.
  • int $decimals: Precision of number of decimal places. Deprecated.

Return values

returns:False on failure. Number string on success.

Source code

function size_format( $bytes, $decimals = 0 ) {

	$quant = array(

		// ========================= Origin ====

		'TB' => 1099511627776,  // pow( 1024, 4)

		'GB' => 1073741824,     // pow( 1024, 3)

		'MB' => 1048576,        // pow( 1024, 2)

		'kB' => 1024,           // pow( 1024, 1)

		'B ' => 1,              // pow( 1024, 0)

	);

	foreach ( $quant as $unit => $mag )

		if ( doubleval($bytes) >= $mag )

			return number_format_i18n( $bytes / $mag, $decimals ) . ' ' . $unit;



	return false;

}

2899

site_url

Definition:
function site_url( $path = '', $scheme = null ) {}

Retrieve the site url for the current site.
Returns the ‘site_url’ option with the appropriate protocol, ‘https’ if is_ssl() and ‘http’ otherwise. If $scheme is ‘http’ or ‘https’, is_ssl() is overridden.

Parameters

  • string $path: Optional. Path relative to the site url.
  • string $scheme: Optional. Scheme to give the site url context. Currently ‘http’, ‘https’, ‘login’, ‘login_post’, or ‘admin’.

Return values

returns:Site url link with optional path appended.

Source code

function site_url( $path = '', $scheme = null ) {

	return get_site_url(null, $path, $scheme);

}

2897

site_admin_notice

Definition:
function site_admin_notice() {}

Source code

function site_admin_notice() {

	global $wp_db_version;

	if ( !is_super_admin() )

		return false;

	if ( get_site_option( 'wpmu_upgrade_site' ) != $wp_db_version )

		echo "<div class='update-nag'>" . sprintf( __( 'Thank you for Updating! Please visit the <a href="%s">Update Network</a> page to update all your sites.' ), esc_url( network_admin_url( 'upgrade.php' ) ) ) . "</div>";

}

2895

single_tag_title

Definition:
function single_tag_title( $prefix = '', $display = true ) {}

Display or retrieve page title for tag post archive.
Useful for tag template files for displaying the tag page title. It has less overhead than wp_title(), because of its limited implementation.

Parameters

  • string $prefix: Optional. What to display before the title.
  • bool $display: Optional, default is true. Whether to display or retrieve title.

Return values

returns:Title when retrieving, null when displaying or failure.

Source code

function single_tag_title( $prefix = '', $display = true ) {

	return single_term_title( $prefix, $display );

}

2893

single_post_title

Definition:
function single_post_title($prefix = '', $display = true) {}

Display or retrieve page title for post.
This is optimized for single.php template file for displaying the post title.

Parameters

  • string $prefix: Optional. What to display before the title.
  • bool $display: Optional, default is true. Whether to display or retrieve title.

Return values

returns:Title when retrieving, null when displaying or failure.

Defined filters

  • single_post_title
    apply_filters('single_post_title', $_post->post_title, $_post)

Source code

function single_post_title($prefix = '', $display = true) {

	$_post = get_queried_object();



	if ( !isset($_post->post_title) )

		return;



	$title = apply_filters('single_post_title', $_post->post_title, $_post);

	if ( $display )

		echo $prefix . $title;

	else

		return $title;

}

2891