-
-
Save adamsilverstein/cd2675feb7233e4849b7 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 ); |
This is awesome, thanks! I am so tired of my clients forgetting to set "link" to media file ...
should this code be placed in functions.php?
@riddy92 yes! Note this is 5 year old code so not sure it still works!
I am not sure also, I ended up using CSS to solve my issue.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
does not work as expected