Provide alt text for uploaded header images.

The custom header screen will use it rather then the description,
if an alt text is set.

Props francoeurdavid, voldemortensen, valendesigns.
Fixes #27959.



git-svn-id: https://develop.svn.wordpress.org/trunk@32998 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Konstantin Obenland
2015-06-29 21:31:21 +00:00
parent 3a982b1590
commit 6872d9122e
2 changed files with 7 additions and 3 deletions

View File

@@ -1209,10 +1209,13 @@ function get_uploaded_header_images() {
$url = esc_url_raw( wp_get_attachment_url( $header->ID ) );
$header_data = wp_get_attachment_metadata( $header->ID );
$header_index = basename($url);
$header_images[$header_index] = array();
$header_images[$header_index]['attachment_id'] = $header->ID;
$header_images[$header_index]['attachment_id'] = $header->ID;
$header_images[$header_index]['url'] = $url;
$header_images[$header_index]['thumbnail_url'] = $url;
$header_images[$header_index]['thumbnail_url'] = $url;
$header_images[$header_index]['alt_text'] = get_post_meta( $header->ID, '_wp_attachment_image_alt', true );
if ( isset( $header_data['width'] ) )
$header_images[$header_index]['width'] = $header_data['width'];
if ( isset( $header_data['height'] ) )