gallery_style
Filters the gallery shortcode's default CSS styles and opening HTML div container.
To remove the CSS entirely, use the use_default_gallery_style instead:
add_filter( 'use_default_gallery_style', '__return_false' );
Usage
add_filter( 'gallery_style', 'wp_kama_gallery_style_filter' );
/**
* Function for `gallery_style` filter-hook.
*
* @param string $gallery_style Default CSS styles and opening HTML div container for the gallery
* shortcode output.
*
* @return string
*/
function wp_kama_gallery_style_filter( $gallery_style ){
// filter...
return $gallery_style;
}
- $gallery_style(string)
- Default CSS styles and opening HTML div container for the gallery shortcode output.
Changelog
| Since 2.5.0 | Introduced. |
| Since 3.1.0 | Added classes for number of columns and size to opening div. |
| Since 5.3.0 | Removed the type attribute for style tags when the theme supports HTML5 style, and changed the quotes from single to double for other themes. |
| Since 7.0.0 | Removed the type attribute for any theme. |
Where the hook is called
wp-includes/media.php 3033
$output = apply_filters( 'gallery_style', $gallery_style . $gallery_div );