Do not output default gallery styles if the theme has opted into HTML5 galleries.

fixes #27045. see #26697.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27244 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2014-03-04 18:53:13 +00:00
parent 1ff0aebf20
commit 978e394248
1 changed files with 15 additions and 3 deletions

View File

@ -875,7 +875,17 @@ function gallery_shortcode( $attr ) {
$selector = "gallery-{$instance}";
$gallery_style = $gallery_div = '';
if ( apply_filters( 'use_default_gallery_style', true ) )
/**
* Filter whether to print default gallery styles.
*
* @since 3.1.0
*
* @param bool $print Whether to print default gallery styles.
* Defaults to false if the theme supports HTML5 galleries.
* Otherwise, defaults to true.
*/
if ( apply_filters( 'use_default_gallery_style', ! $html5 ) ) {
$gallery_style = "
<style type='text/css'>
#{$selector} {
@ -894,10 +904,12 @@ function gallery_shortcode( $attr ) {
margin-left: 0;
}
/* see gallery_shortcode() in wp-includes/media.php */
</style>";
</style>\n\t\t";
}
$size_class = sanitize_html_class( $size );
$gallery_div = "<div id='$selector' class='gallery galleryid-{$id} gallery-columns-{$columns} gallery-size-{$size_class}'>";
$output = apply_filters( 'gallery_style', $gallery_style . "\n\t\t" . $gallery_div );
$output = apply_filters( 'gallery_style', $gallery_style . $gallery_div );
$i = 0;
foreach ( $attachments as $id => $attachment ) {