Created
October 28, 2013 20:59
-
-
Save mjsdiaz/7204576 to your computer and use it in GitHub Desktop.
Use shortcode_atts_gallery filter to add new defaults to the WordPress gallery shortcode. Use image size of medium and 2 columns as new defaults. Allows user input to the post gallery shortcode.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* Use only code below | |
/** | |
* Use shortcode_atts_gallery filter to add new defaults to the WordPress gallery shortcode. | |
* New gallery shortcode defaults (columns="2" and size="medium"). | |
* Allows user input in the post gallery shortcode. | |
* | |
* @author Marcy Diaz | |
* @link http://amethystwebsitedesign.com/how-to-use-larger-images-in-a-wordpress-gallery/ | |
*/ | |
function amethyst_gallery_atts( $out, $pairs, $atts ) { | |
$atts = shortcode_atts( array( | |
'columns' => '2', | |
'size' => 'medium', | |
), $atts ); | |
$out['columns'] = $atts['columns']; | |
$out['size'] = $atts['size']; | |
return $out; | |
} | |
add_filter( 'shortcode_atts_gallery', 'amethyst_gallery_atts', 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment