mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-05 01:30:15 +00:00
Add a 6th (!) attribute to wp_get_attachment_link() to allow aria-describedby to be added to gallery output.
Props joedolson, DrewAPicture, rianrietveld. Fixes #27402. git-svn-id: https://develop.svn.wordpress.org/trunk@29914 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -1056,12 +1056,14 @@ function gallery_shortcode( $attr ) {
|
||||
|
||||
$i = 0;
|
||||
foreach ( $attachments as $id => $attachment ) {
|
||||
|
||||
$attr = ( trim( $attachment->post_excerpt ) ) ? array( 'aria-describedby' => "$selector-$id" ) : '';
|
||||
if ( ! empty( $atts['link'] ) && 'file' === $atts['link'] ) {
|
||||
$image_output = wp_get_attachment_link( $id, $atts['size'], false, false );
|
||||
$image_output = wp_get_attachment_link( $id, $atts['size'], false, false, $attr );
|
||||
} elseif ( ! empty( $atts['link'] ) && 'none' === $atts['link'] ) {
|
||||
$image_output = wp_get_attachment_image( $id, $atts['size'], false );
|
||||
$image_output = wp_get_attachment_image( $id, $atts['size'], false, $attr );
|
||||
} else {
|
||||
$image_output = wp_get_attachment_link( $id, $atts['size'], true, false );
|
||||
$image_output = wp_get_attachment_link( $id, $atts['size'], true, false, false, $attr );
|
||||
}
|
||||
$image_meta = wp_get_attachment_metadata( $id );
|
||||
|
||||
@@ -1076,7 +1078,7 @@ function gallery_shortcode( $attr ) {
|
||||
</{$icontag}>";
|
||||
if ( $captiontag && trim($attachment->post_excerpt) ) {
|
||||
$output .= "
|
||||
<{$captiontag} class='wp-caption-text gallery-caption'>
|
||||
<{$captiontag} class='wp-caption-text gallery-caption' id='$selector-$id'>
|
||||
" . wptexturize($attachment->post_excerpt) . "
|
||||
</{$captiontag}>";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user