diff --git src/wp-includes/media.php src/wp-includes/media.php
index 9bf83bb..a7b7ab1 100644
|
|
function img_caption_shortcode( $attr, $content = null ) { |
900 | 900 | |
901 | 901 | $class = trim( 'wp-caption ' . $atts['align'] . ' ' . $atts['class'] ); |
902 | 902 | |
903 | | if ( current_theme_supports( 'html5', 'caption' ) ) { |
904 | | return '<figure ' . $atts['id'] . 'style="width: ' . (int) $atts['width'] . 'px;" class="' . esc_attr( $class ) . '">' |
905 | | . do_shortcode( $content ) . '<figcaption class="wp-caption-text">' . $atts['caption'] . '</figcaption></figure>'; |
906 | | } |
907 | | |
908 | | $caption_width = 10 + $atts['width']; |
| 903 | // HTML5 captions never added the extra 10px to the image width |
| 904 | $caption_width = current_theme_supports( 'html5', 'caption' ) ? $atts['width'] : 10 + $atts['width']; |
909 | 905 | |
910 | 906 | /** |
911 | 907 | * Filter the width of an image's caption. |
… |
… |
function img_caption_shortcode( $attr, $content = null ) { |
928 | 924 | if ( $caption_width ) |
929 | 925 | $style = 'style="width: ' . (int) $caption_width . 'px" '; |
930 | 926 | |
931 | | return '<div ' . $atts['id'] . $style . 'class="' . esc_attr( $class ) . '">' |
932 | | . do_shortcode( $content ) . '<p class="wp-caption-text">' . $atts['caption'] . '</p></div>'; |
| 927 | $html = ''; |
| 928 | if ( current_theme_supports( 'html5', 'caption' ) ) { |
| 929 | $html = '<figure ' . $atts['id'] . $style . 'class="' . esc_attr( $class ) . '">' |
| 930 | . do_shortcode( $content ) . '<figcaption class="wp-caption-text">' . $atts['caption'] . '</figcaption></figure>'; |
| 931 | } else { |
| 932 | $html = '<div ' . $atts['id'] . $style . 'class="' . esc_attr( $class ) . '">' |
| 933 | . do_shortcode( $content ) . '<p class="wp-caption-text">' . $atts['caption'] . '</p></div>'; |
| 934 | } |
| 935 | |
| 936 | return $html; |
933 | 937 | } |
934 | 938 | |
935 | 939 | add_shortcode('gallery', 'gallery_shortcode'); |