get_background_color

Definition:
function get_background_color() {}

Retrieve value for custom background color.

Source code

function get_background_color() {

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



	return get_theme_mod('background_color', $default);

}

1190

get_avatar

Definition:
function get_avatar( $id_or_email, $size = '96', $default = '', $alt = false ) {}

Retrieve the avatar for a user who provided a user ID or email address.

Parameters

  • int|string|object $id_or_email: A user ID, email address, or comment object
  • int $size: Size of the avatar image
  • string $default: URL to a default image to use if no avatar is available
  • string $alt: Alternate text to use in image tag. Defaults to blank

Return values

returns:<img> tag for the user’s avatar

Defined filters

  • get_avatar_comment_types
    apply_filters( 'get_avatar_comment_types', array( 'comment' )

Source code

function get_avatar( $id_or_email, $size = '96', $default = '', $alt = false ) {

	if ( ! get_option('show_avatars') )

		return false;



	if ( false === $alt)

		$safe_alt = '';

	else

		$safe_alt = esc_attr( $alt );



	if ( !is_numeric($size) )

		$size = '96';



	$email = '';

	if ( is_numeric($id_or_email) ) {

		$id = (int) $id_or_email;

		$user = get_userdata($id);

		if ( $user )

			$email = $user->user_email;

	} elseif ( is_object($id_or_email) ) {

		// No avatar for pingbacks or trackbacks

		$allowed_comment_types = apply_filters( 'get_avatar_comment_types', array( 'comment' ) );

		if ( ! empty( $id_or_email->comment_type ) && ! in_array( $id_or_email->comment_type, (array) $allowed_comment_types ) )

			return false;



		if ( !empty($id_or_email->user_id) ) {

			$id = (int) $id_or_email->user_id;

			$user = get_userdata($id);

			if ( $user)

				$email = $user->user_email;

		} elseif ( !empty($id_or_email->comment_author_email) ) {

			$email = $id_or_email->comment_author_email;

		}

	} else {

		$email = $id_or_email;

	}



	if ( empty($default) ) {

		$avatar_default = get_option('avatar_default');

		if ( empty($avatar_default) )

			$default = 'mystery';

		else

			$default = $avatar_default;

	}



	if ( !empty($email) )

		$email_hash = md5( strtolower( $email ) );



	if ( is_ssl() ) {

		$host = 'https://secure.gravatar.com';

	} else {

		if ( !empty($email) )

			$host = sprintf( "http://%d.gravatar.com", ( hexdec( $email_hash[0] ) % 2 ) );

		else

			$host = 'http://0.gravatar.com';

	}



	if ( 'mystery' == $default )

		$default = "$host/avatar/ad516503a11cd5ca435acc9bb6523536?s={$size}"; // ad516503a11cd5ca435acc9bb6523536 == md5('unknown@gravatar.com')

1188

get_available_post_statuses

Definition:
function get_available_post_statuses($type = 'post') {}

Get all the possible statuses for a post_type

Parameters

  • string $type: The post_type you want the statuses for

Return values

returns:As array of all the statuses for the supplied post type

Source code

function get_available_post_statuses($type = 'post') {

	$stati = wp_count_posts($type);



	return array_keys(get_object_vars($stati));

}

1186

get_available_post_mime_types

Definition:
function get_available_post_mime_types($type = 'attachment') {}

Parameters

  • unknown_type $type

Source code

function get_available_post_mime_types($type = 'attachment') {

	global $wpdb;



	$types = $wpdb->get_col($wpdb->prepare("SELECT DISTINCT post_mime_type FROM $wpdb->posts WHERE post_type = %s", $type));

	return $types;

}

1184

get_available_languages

Definition:
function get_available_languages( $dir = null ) {}

Get all available languages based on the presence of *.mo files in a given directory. The default directory is WP_LANG_DIR.

Parameters

  • string $dir: A directory in which to search for language files. The default directory is WP_LANG_DIR.

Return values

returns:Array of language codes or an empty array if no languages are present. Language codes are formed by stripping the .mo extension from the language file names.

Source code

function get_available_languages( $dir = null ) {

	$languages = array();



	foreach( (array)glob( ( is_null( $dir) ? WP_LANG_DIR : $dir ) . '/*.mo' ) as $lang_file ) {

		$lang_file = basename($lang_file, '.mo');

		if ( 0 !== strpos( $lang_file, 'continents-cities' ) && 0 !== strpos( $lang_file, 'ms-' ) )

			$languages[] = $lang_file;

	}



	return $languages;

}

1182