diff --git a/src/wp-includes/media.php b/src/wp-includes/media.php index ebcfa0e387..62c124aaa9 100644 --- a/src/wp-includes/media.php +++ b/src/wp-includes/media.php @@ -762,9 +762,12 @@ add_shortcode('gallery', 'gallery_shortcode'); * @type string $orderby The field to use when ordering the images. Default 'menu_order ID'. * Accepts any valid SQL ORDERBY statement. * @type int $id Post ID. - * @type string $itemtag HTML tag to use for each image in the gallery. Default 'dl'. - * @type string $icontag HTML tag to use for each image's icon. Default 'dt'. - * @type string $captiontag HTML tag to use for each image's caption. Default 'dd'. + * @type string $itemtag HTML tag to use for each image in the gallery. + * Default 'dl', or 'figure' when the theme registers HTML5 gallery support. + * @type string $icontag HTML tag to use for each image's icon. + * Default 'dt', or 'div' when the theme registers HTML5 gallery support. + * @type string $captiontag HTML tag to use for each image's caption. + * Default 'dd', or 'figcaption' when the theme registers HTML5 gallery support. * @type int $columns Number of columns of images to display. Default 3. * @type string $size Size of the images to display. Default 'thumbnail'. * @type string $ids A comma-separated list of IDs of attachments to display. Default empty. @@ -812,13 +815,14 @@ function gallery_shortcode( $attr ) { unset( $attr['orderby'] ); } + $html5 = current_theme_supports( 'html5', 'gallery' ); extract(shortcode_atts(array( 'order' => 'ASC', 'orderby' => 'menu_order ID', 'id' => $post ? $post->ID : 0, - 'itemtag' => 'dl', - 'icontag' => 'dt', - 'captiontag' => 'dd', + 'itemtag' => $html5 ? 'figure' : 'dl', + 'icontag' => $html5 ? 'div' : 'dt', + 'captiontag' => $html5 ? 'figcaption' : 'dd', 'columns' => 3, 'size' => 'thumbnail', 'include' => '',