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:
parent
3a982b1590
commit
6872d9122e
@ -279,12 +279,13 @@ class Custom_Image_Header {
|
||||
$header_thumbnail = $header['thumbnail_url'];
|
||||
$header_url = $header['url'];
|
||||
$header_desc = empty( $header['description'] ) ? '' : $header['description'];
|
||||
$header_alt_text = empty( $header['alt_text'] ) ? $header_desc : $header['alt_text'];
|
||||
echo '<div class="default-header">';
|
||||
echo '<label><input name="default-header" type="radio" value="' . esc_attr( $header_key ) . '" ' . checked( $header_url, get_theme_mod( 'header_image' ), false ) . ' />';
|
||||
$width = '';
|
||||
if ( !empty( $header['attachment_id'] ) )
|
||||
$width = ' width="230"';
|
||||
echo '<img src="' . set_url_scheme( $header_thumbnail ) . '" alt="' . esc_attr( $header_desc ) .'" title="' . esc_attr( $header_desc ) . '"' . $width . ' /></label>';
|
||||
echo '<img src="' . set_url_scheme( $header_thumbnail ) . '" alt="' . esc_attr( $header_alt_text ) .'" title="' . esc_attr( $header_desc ) . '"' . $width . ' /></label>';
|
||||
echo '</div>';
|
||||
}
|
||||
echo '<div class="clear"></div></div>';
|
||||
|
@ -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'] ) )
|
||||
|
Loading…
Reference in New Issue
Block a user