Ticket #27402: 27402.4.patch
File 27402.4.patch, 2.7 KB (added by , 6 years ago) |
---|
-
wp-includes/media.php
1056 1056 1057 1057 $i = 0; 1058 1058 foreach ( $attachments as $id => $attachment ) { 1059 1060 $attr = ( trim( $attachment->post_excerpt ) ) ? array( 'aria-describedby' => "$selector-$id" ) : ''; 1059 1061 if ( ! empty( $atts['link'] ) && 'file' === $atts['link'] ) { 1060 $image_output = wp_get_attachment_link( $id, $atts['size'], false, false );1062 $image_output = wp_get_attachment_link( $id, $atts['size'], false, false, $attr ); 1061 1063 } elseif ( ! empty( $atts['link'] ) && 'none' === $atts['link'] ) { 1062 $image_output = wp_get_attachment_image( $id, $atts['size'], false );1064 $image_output = wp_get_attachment_image( $id, $atts['size'], false, $attr ); 1063 1065 } else { 1064 $image_output = wp_get_attachment_link( $id, $atts['size'], true, false );1066 $image_output = wp_get_attachment_link( $id, $atts['size'], true, false, false, $attr ); 1065 1067 } 1066 1068 $image_meta = wp_get_attachment_metadata( $id ); 1067 1069 … … 1076 1078 </{$icontag}>"; 1077 1079 if ( $captiontag && trim($attachment->post_excerpt) ) { 1078 1080 $output .= " 1079 <{$captiontag} class='wp-caption-text gallery-caption' >1081 <{$captiontag} class='wp-caption-text gallery-caption' id='$selector-$id'> 1080 1082 " . wptexturize($attachment->post_excerpt) . " 1081 1083 </{$captiontag}>"; 1082 1084 } -
wp-includes/post-template.php
1462 1462 * @param bool $permalink Optional, default is false. Whether to add permalink to image. 1463 1463 * @param bool $icon Optional, default is false. Whether to include icon. 1464 1464 * @param string|bool $text Optional, default is false. If string, then will be link text. 1465 * @param array|string $attr Optional. Array or string of attributes. 1465 1466 * @return string HTML content. 1466 1467 */ 1467 function wp_get_attachment_link( $id = 0, $size = 'thumbnail', $permalink = false, $icon = false, $text = false ) {1468 function wp_get_attachment_link( $id = 0, $size = 'thumbnail', $permalink = false, $icon = false, $text = false, $attr = '' ) { 1468 1469 $id = intval( $id ); 1469 1470 $_post = get_post( $id ); 1470 1471 … … 1474 1475 if ( $permalink ) 1475 1476 $url = get_attachment_link( $_post->ID ); 1476 1477 1477 if ( $text ) 1478 if ( $text ) { 1478 1479 $link_text = $text; 1479 elseif ( $size && 'none' != $size )1480 $link_text = wp_get_attachment_image( $id, $size, $icon );1481 else1480 } elseif ( $size && 'none' != $size ) { 1481 $link_text = wp_get_attachment_image( $id, $size, $icon, $attr ); 1482 } else { 1482 1483 $link_text = ''; 1484 } 1483 1485 1484 1486 if ( trim( $link_text ) == '' ) 1485 1487 $link_text = $_post->post_title;