Ticket #34595: 34595.patch
File 34595.patch, 1.5 KB (added by , 8 years ago) |
---|
-
wp-includes/media.php
1397 1397 if ( $atts['width'] < 1 || empty( $atts['caption'] ) ) 1398 1398 return $content; 1399 1399 1400 if ( ! empty( $atts['id'] ) ) 1401 $atts['id'] = 'id="' . esc_attr( sanitize_html_class( $atts['id'] ) ) . '" '; 1400 if ( ! empty( $atts['id'] ) ) { 1401 $att_id = esc_attr( sanitize_html_class( $atts['id'] ) ); 1402 $atts['id'] = 'id="' . $att_id . '" '; 1403 } 1402 1404 1403 1405 $class = trim( 'wp-caption ' . $atts['align'] . ' ' . $atts['class'] ); 1404 1406 … … 1429 1431 1430 1432 $html = ''; 1431 1433 if ( $html5 ) { 1432 $html = '<figure ' . $atts['id'] . $style . 'class="' . esc_attr( $class ) . '" >'1433 . do_shortcode( $content ) . '<figcaption class="wp-caption-text" >' . $atts['caption'] . '</figcaption></figure>';1434 $html = '<figure ' . $atts['id'] . $style . 'class="' . esc_attr( $class ) . '"' . 'aria-describedby="caption-' . $att_id . '">' 1435 . do_shortcode( $content ) . '<figcaption class="wp-caption-text" id="caption-' . $att_id .'">' . $atts['caption'] . '</figcaption></figure>'; 1434 1436 } else { 1435 1437 $html = '<div ' . $atts['id'] . $style . 'class="' . esc_attr( $class ) . '">' 1436 . do_shortcode( $content ) . '<p class="wp-caption-text">' . $atts['caption'] . '</p></div>';1438 . str_replace( '<img', '<img aria-describedby="caption-' . $att_id . '"', do_shortcode( $content ) ) . '<p class="wp-caption-text" id="caption-' . $att_id .'">' . $atts['caption'] . '</p></div>'; 1437 1439 } 1438 1440 1439 1441 return $html;