Skip to content

Commit 3f1fbe7

Browse files
committed
Docs: Clarify the gallery_style and use_default_gallery_style filters.
* Note that the `gallery_style` filter receives the opening HTML `DIV` container in addition to the default CSS. * Point to the `use_default_gallery_style` filter as the way to remove the styles entirely. * Add the missing `@since` changelog entries describing how the filtered markup has evolved. Developed in WordPress#12060. Follow-up to r16865, r27396, r46164, r61411. Props sabernhardt, ov3rfly, westonruter. See #64442. Fixes #65317. git-svn-id: https://develop.svn.wordpress.org/trunk@62455 602fd350-edb4-49c9-b593-d223f7449a82
1 parent d3d0745 commit 3f1fbe7

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

src/wp-includes/media.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2885,6 +2885,7 @@ function gallery_shortcode( $attr ) {
28852885
* Filters whether to print default gallery styles.
28862886
*
28872887
* @since 3.1.0
2888+
* @since 3.9.0 Set the default to false when the theme supports HTML5 galleries.
28882889
*
28892890
* @param bool $print Whether to print default gallery styles.
28902891
* Defaults to false if the theme supports HTML5 galleries.
@@ -2916,9 +2917,18 @@ function gallery_shortcode( $attr ) {
29162917
$gallery_div = "<div id='$selector' class='gallery galleryid-{$id} gallery-columns-{$columns} gallery-size-{$size_class}'>";
29172918

29182919
/**
2919-
* Filters the default gallery shortcode CSS styles.
2920+
* Filters the gallery shortcode's default CSS styles and opening HTML div container.
2921+
*
2922+
* To remove the CSS entirely, use the `use_default_gallery_style` filter instead:
2923+
*
2924+
* add_filter( 'use_default_gallery_style', '__return_false' );
29202925
*
29212926
* @since 2.5.0
2927+
* @since 3.1.0 Added classes for number of columns and size to opening div.
2928+
* @since 5.3.0 Removed the `type` attribute for `style` tags when the theme
2929+
* supports HTML5 style, and changed the quotes from single to
2930+
* double for other themes.
2931+
* @since 7.0.0 Removed the `type` attribute for any theme.
29222932
*
29232933
* @param string $gallery_style Default CSS styles and opening HTML div container
29242934
* for the gallery shortcode output.

0 commit comments

Comments
 (0)