mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-30 20:21:37 +01:00
Themes: Improve the theme Custom Logo accessibility.
Uses the Site title as fallback value for the Custom Logo alt attribute when the original alt attribute is empty. Props sami.keijonen, joedolson, sstoqnov, nobremarcos, gma992, LiamMcArthur, jjcomack. Fixes #38768. Built from https://develop.svn.wordpress.org/trunk@40817 git-svn-id: http://core.svn.wordpress.org/trunk@40675 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
bdad500af7
commit
2cbd9cf75e
@ -888,12 +888,27 @@ function get_custom_logo( $blog_id = 0 ) {
|
||||
|
||||
// We have a logo. Logo is go.
|
||||
if ( $custom_logo_id ) {
|
||||
$custom_logo_attr = array(
|
||||
'class' => 'custom-logo',
|
||||
'itemprop' => 'logo',
|
||||
);
|
||||
|
||||
/*
|
||||
* If the logo alt attribute is empty, get the site title and explicitly
|
||||
* pass it to the attributes used by wp_get_attachment_image().
|
||||
*/
|
||||
$image_alt = get_post_meta( $custom_logo_id, '_wp_attachment_image_alt', true );
|
||||
if ( empty( $image_alt ) ) {
|
||||
$custom_logo_attr['alt'] = get_bloginfo( 'name', 'display' );
|
||||
}
|
||||
|
||||
/*
|
||||
* If the alt attribute is not empty, there's no need to explicitly pass
|
||||
* it because wp_get_attachment_image() already adds the alt attribute.
|
||||
*/
|
||||
$html = sprintf( '<a href="%1$s" class="custom-logo-link" rel="home" itemprop="url">%2$s</a>',
|
||||
esc_url( home_url( '/' ) ),
|
||||
wp_get_attachment_image( $custom_logo_id, 'full', false, array(
|
||||
'class' => 'custom-logo',
|
||||
'itemprop' => 'logo',
|
||||
) )
|
||||
wp_get_attachment_image( $custom_logo_id, 'full', false, $custom_logo_attr )
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.8-beta1-40816';
|
||||
$wp_version = '4.8-beta1-40817';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user