Ticket #27402: 27402.2.patch
File 27402.2.patch, 2.4 KB (added by , 7 years ago) |
---|
-
wp-includes/media.php
962 962 963 963 $i = 0; 964 964 foreach ( $attachments as $id => $attachment ) { 965 $attr = ( trim($attachment->post_excerpt) ) ? array( 'aria-describedby' => "$selector-$id" ) : ''; 966 965 967 if ( ! empty( $link ) && 'file' === $link ) 966 $image_output = wp_get_attachment_link( $id, $size, false, false );968 $image_output = wp_get_attachment_link( $id, $size, false, false, false, $attr ); 967 969 elseif ( ! empty( $link ) && 'none' === $link ) 968 $image_output = wp_get_attachment_image( $id, $size, false );970 $image_output = wp_get_attachment_image( $id, $size, false, $attr ); 969 971 else 970 $image_output = wp_get_attachment_link( $id, $size, true, false );972 $image_output = wp_get_attachment_link( $id, $size, true, false, false, $attr ); 971 973 972 974 $image_meta = wp_get_attachment_metadata( $id ); 973 975 … … 982 984 </{$icontag}>"; 983 985 if ( $captiontag && trim($attachment->post_excerpt) ) { 984 986 $output .= " 985 <{$captiontag} class='wp-caption-text gallery-caption' >987 <{$captiontag} class='wp-caption-text gallery-caption' id='$selector-$id'> 986 988 " . wptexturize($attachment->post_excerpt) . " 987 989 </{$captiontag}>"; 988 990 } -
wp-includes/post-template.php
1199 1199 * @param bool $permalink Optional, default is false. Whether to add permalink to image. 1200 1200 * @param bool $icon Optional, default is false. Whether to include icon. 1201 1201 * @param string|bool $text Optional, default is false. If string, then will be link text. 1202 * @param mixed $attr Optional, attributes for the image markup. 1202 1203 * @return string HTML content. 1203 1204 */ 1204 function wp_get_attachment_link( $id = 0, $size = 'thumbnail', $permalink = false, $icon = false, $text = false ) {1205 function wp_get_attachment_link( $id = 0, $size = 'thumbnail', $permalink = false, $icon = false, $text = false, $attr = '' ) { 1205 1206 $id = intval( $id ); 1206 1207 $_post = get_post( $id ); 1207 1208 … … 1216 1217 if ( $text ) 1217 1218 $link_text = $text; 1218 1219 elseif ( $size && 'none' != $size ) 1219 $link_text = wp_get_attachment_image( $id, $size, $icon );1220 $link_text = wp_get_attachment_image( $id, $size, $icon, $attr ); 1220 1221 else 1221 1222 $link_text = ''; 1222 1223