How to change default gallery image size
-
I am using Twenty-Twenty theme with the very basic, included Gallery options.
I have used the following code in functions.php to change the link and number of columns (so I don’t have to change them every time I create a gallery):
function theme_gallery_defaults( $settings ) { $settings['galleryDefaults']['columns'] = 4; $settings['galleryDefaults']['link'] = 'file'; return $settings; } add_filter( 'media_view_settings', 'theme_gallery_defaults' );
Occasionally I would like to create galleries that are three columns wide instead of four, but the default thumbnail size is too small and leaves a lot of space. I’d like to use a larger thumbnail for a three-column gallery.
I have added the code in functions to create new image sizes and it works! My new image size even shows up in the gallery interface, and I can choose it and it displays properly.
I have discovered that this particular gallery smallenizes the thumbnail to fit (for instance, if I use five columns, it resizes the thumbnails to 100×100 instead of 150×150). So I figured if I used my new image size as the default, it wouldn’t matter. And it doesn’t! But I have to change it every time. I’d like to have it automatically selected, by default. I tried adding the following to the above code:
$settings['galleryDefaults']['size'] = 'three-wide';
But that didn’t work.So now I’m stuck!
How can I have my new image size selected by default in the gallery interface?
Thanks!
- The topic ‘How to change default gallery image size’ is closed to new replies.