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

fixes #27045. see #26697.


git-svn-id: https://develop.svn.wordpress.org/trunk@27396 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin 2014-03-04 18:52:34 +00:00
parent ed43f002b8
commit f0b330e994

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 ) {