Advertisements

get_uploaded_header_images

Definition:
function get_uploaded_header_images() {}

Get the header images uploaded for the current theme.

Source code

function get_uploaded_header_images() {

	$header_images = array();



	// @todo caching

	$headers = get_posts( array( 'post_type' => 'attachment', 'meta_key' => '_wp_attachment_is_custom_header', 'meta_value' => get_option('stylesheet'), 'orderby' => 'none', 'nopaging' => true ) );



	if ( empty( $headers ) )

		return array();



	foreach ( (array) $headers as $header ) {

		$url = esc_url_raw( $header->guid );

		$header = basename($url);

		$header_images[$header] = array();

		$header_images[$header]['url'] =  $url;

		$header_images[$header]['thumbnail_url'] =  $url;

		$header_images[$header]['uploaded'] = true;

	}



	return $header_images;

}

14077

Advertisements

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: