I’ve said it over and over again: I love working with the Divi theme, but – and there is always a ‘but’ – there’s some features I wish were already baked in.

One of these features which I would love to see implemented in the future (and considering you are reading this post I’m sure you would too) is an option to change Divi’s default thumbnails to be square.

Currently the thumbnails in the gallery module can either be set to either landscape or portrait, which ends up looking like this:

A client asked me to add some new images to their Divi gallery module, of course all of the images were square cropped so neither the landscape or the portrait thumbnail settings looked right.

There was only one thing for it: I had to make the gallery module thumbnails square.

Here’s how I did it and you can too…

First of all you’ll want to create a child theme if you haven’t already. Our solution will require us to add some code to Divi’s functions.php file and doing this without a child theme will mean that every time you update Divi you will have to repeat this entire process again.

Edit your functions.php file in your child theme and add the following code to it –

function my_et_pb_gallery_image_size( $size ) {
return 225;
}
add_filter( 'et_pb_gallery_image_width', 'my_et_pb_gallery_image_size' );

function my_et_pb_gallery_image_size_height( $size ) {
return 225;
}
add_filter( 'et_pb_gallery_image_height', 'my_et_pb_gallery_image_size_height' );


function my_et_theme_image_sizes( $sizes ) {
$sizes['225x225'] = 'my-et-pb-post-main-image';
return $sizes;
}
add_filter( 'et_theme_image_sizes', 'my_et_theme_image_sizes' );

Once you’ve done that go ahead and save the file. Be sure to upload it if you’re not editing it within WordPress.

Now check out your gallery module. You might be lucky enough to see the changes right away like I was.

If you can see the changes and everything looks good then that’s all there is to it.

However, if you don’t see the changes yet, don’t panic! There’s an extra step to get things working properly.

Download the WordPress plugin called ‘Regenerate Thumbnails’ and then run it.

Let it do what it needs to and once it’s finished updating your thumbnails you should be all set.

How Can I Help?

Website Design

Looking for a beautiful, easy to maintain website that helps you connect with your audience? You've come to the right place.

Find Out More

Divi Extensions

Give your website a low-cost makeover or add some exciting new functions, it's easy with these excellent Divi resources.

View Products

Collaborations

Searching for a forward-thinking, creative Divi designer to add to your agency? See how I can delight your clients.

Learn More

Answer the following three questions to see if we’re a match.