Ticket #27402: 27402.3.patch
File 27402.3.patch, 2.8 KB (added by , 11 years ago) |
---|
-
src/wp-includes/media.php
1047 1047 1048 1048 $i = 0; 1049 1049 foreach ( $attachments as $id => $attachment ) { 1050 if ( ! empty( $link ) && 'file' === $link ) 1051 $image_output = wp_get_attachment_link( $id, $size, false, false ); 1052 elseif ( ! empty( $link ) && 'none' === $link ) 1053 $image_output = wp_get_attachment_image( $id, $size, false ); 1054 else 1055 $image_output = wp_get_attachment_link( $id, $size, true, false ); 1050 $attr = ( trim( $attachment->post_excerpt ) ) ? array( 'aria-describedby' => "$selector-$id" ) : ''; 1051 1052 if ( ! empty( $link ) && 'file' === $link ) { 1053 $image_output = wp_get_attachment_link( $id, $size, false, false, false, $attr ); 1054 } elseif ( ! empty( $link ) && 'none' === $link ) { 1055 $image_output = wp_get_attachment_image( $id, $size, false, $attr ); 1056 } else { 1057 $image_output = wp_get_attachment_link( $id, $size, true, false, false, $attr ); 1058 } 1056 1059 1057 1060 $image_meta = wp_get_attachment_metadata( $id ); 1058 1061 … … 1067 1070 </{$icontag}>"; 1068 1071 if ( $captiontag && trim($attachment->post_excerpt) ) { 1069 1072 $output .= " 1070 <{$captiontag} class='wp-caption-text gallery-caption' >1073 <{$captiontag} class='wp-caption-text gallery-caption' id='$selector-$id'> 1071 1074 " . wptexturize($attachment->post_excerpt) . " 1072 1075 </{$captiontag}>"; 1073 1076 } -
src/wp-includes/post-template.php
1400 1400 * @param bool $permalink Optional, default is false. Whether to add permalink to image. 1401 1401 * @param bool $icon Optional, default is false. Whether to include icon. 1402 1402 * @param string|bool $text Optional, default is false. If string, then will be link text. 1403 * @param array|string $attr Optional. Array or string of attributes. 1403 1404 * @return string HTML content. 1404 1405 */ 1405 function wp_get_attachment_link( $id = 0, $size = 'thumbnail', $permalink = false, $icon = false, $text = false ) {1406 function wp_get_attachment_link( $id = 0, $size = 'thumbnail', $permalink = false, $icon = false, $text = false, $attr = '' ) { 1406 1407 $id = intval( $id ); 1407 1408 $_post = get_post( $id ); 1408 1409 … … 1414 1415 1415 1416 $post_title = esc_attr( $_post->post_title ); 1416 1417 1417 if ( $text ) 1418 if ( $text ) { 1418 1419 $link_text = $text; 1419 elseif ( $size && 'none' != $size )1420 $link_text = wp_get_attachment_image( $id, $size, $icon );1421 else1420 } elseif ( $size && 'none' != $size ) { 1421 $link_text = wp_get_attachment_image( $id, $size, $icon, $attr ); 1422 } else { 1422 1423 $link_text = ''; 1424 } 1423 1425 1424 1426 if ( trim( $link_text ) == '' ) 1425 1427 $link_text = $_post->post_title;