Introduce HTML5 gallery support.

When a theme supports HTML5 galleries via add_theme_support( 'html5', 'gallery' ), figure and figcaption will be used instead of definition list markup.

props obenland.
fixes #26697.

Built from https://develop.svn.wordpress.org/trunk@27302


git-svn-id: http://core.svn.wordpress.org/trunk@27155 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2014-02-26 22:20:31 +00:00
parent 8dc5888cfa
commit e8819fc636
1 changed files with 10 additions and 6 deletions

View File

@ -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' => '',