gallery_style

Filters the default gallery shortcode CSS styles.

Description

apply_filters( 'gallery_style', (string) $gallery_style_gallery_div ); 

Parameters (1)

0. $gallery_style_gallery_div (string)
Default CSS styles and opening HTML div container for the gallery shortcode output.

Usage

To run the hook, copy the example below.
  1. $gallery_style_gallery_div = apply_filters( 'gallery_style', $gallery_style_gallery_div ); 
  2.  
  3. if ( !empty( $gallery_style_gallery_div ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the gallery_style callback 
  2. function filter_gallery_style( $gallery_style_gallery_div ) { 
  3. // make filter magic happen here... 
  4. return $gallery_style_gallery_div
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'gallery_style', 'filter_gallery_style', 10, 1 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'gallery_style', 'filter_gallery_style', 10, 1 ); 

Defined (1)

The filter is defined in the following location(s).

/wp-includes/media.php  
  1. $output = apply_filters( 'gallery_style', $gallery_style . $gallery_div );