Use shortcode_atts to replace default image size in gallery shortcode
-
Is it possible to use shortcode_atts to give the gallery shortcode a new default image size?
I understand how to add user values that can’t be changed in the gallery in the post, like this:function mj_gallery_atts( $atts ) { $atts['columns'] = '2'; $atts['size'] = 'medium'; return $atts; } add_filter( 'shortcode_atts_gallery', 'mj_gallery_atts', 10, 3 );
But I would really like to just replace the defaults, so that the size and columns can still be overridden in the gallery shortcode in the post.
Is this possible with shortcode_atts or do I need to use another method, like rewrite the entire gallery_shortcode function as in media.php, as has been suggested in older forum posts? Thanks!
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Use shortcode_atts to replace default image size in gallery shortcode’ is closed to new replies.