Make Divi Gallery Thumbnails Square

How to Make Divi Gallery Thumbnails Square? So far i have found 2 ways: Add code to child theme function file as found here: https://worthitmedia.co.uk/make-divis-gallery-module-thumbnails-square/ by adding  this: /** * Make Divi gallery square */ 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' ); My results and totally square.. but then my images were not square in the first place… EDIT CSS: Ive not tried this but i have found 2 site mention it – add this to you child theme CSS: https://divi.space/tutorials/how-to-change-the-size-aspect-ratios-of-the-portfolio-grid-images/ .et_portfolio_image { padding-top: 100%; } .et_portfolio_image img { position: absolute; height: 100%; top: 0; left: 0; right: 0; bottom: 0; object-fit: cover; } https://www.peeayecreative.com/change-the-divi-gallery-image-aspect-ratio/ /*image gallery item aspect ratio square 1:1*/ .pa-image-gallery-1-1 .et_pb_gallery_image { padding-top: 100%; display: block; } .pa-image-gallery-1-1 .et_pb_gallery_item img { position: absolute; height: 100%; width: 100%; top: 0; left: 0; right: 0; bottom: 0; object-fit: cover; }

How to Make Divi Gallery Thumbnails Square?

So far i have found 2 ways:

    1. Add code to child theme function file
      as found here: https://worthitmedia.co.uk/make-divis-gallery-module-thumbnails-square/
      by adding  this:

      /**
      * Make Divi gallery square
      */
      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' );
      

      My results and totally square.. but then my images were not square in the first place…

    2. EDIT CSS:
      Ive not tried this but i have found 2 site mention it – add this to you child theme CSS:
      https://divi.space/tutorials/how-to-change-the-size-aspect-ratios-of-the-portfolio-grid-images/

      .et_portfolio_image {
       padding-top: 100%;
       }
       .et_portfolio_image img {
       position: absolute;
       height: 100%;
       top: 0;
       left: 0;
       right: 0;
       bottom: 0;
       object-fit: cover;
       }

      https://www.peeayecreative.com/change-the-divi-gallery-image-aspect-ratio/

      /*image gallery item aspect ratio square 1:1*/
      
      .pa-image-gallery-1-1 .et_pb_gallery_image {
      padding-top: 100%;
      display: block;
      }
      
      .pa-image-gallery-1-1 .et_pb_gallery_item img {
      position: absolute;
      height: 100%;
      width: 100%;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      object-fit: cover;
      }