Changing the default image sizes in Customizr

In Customizr, there are three image sizes by default defined in class-fire-init.php. Each of them has a specific filter allowing developers to change its properties.


If you need to modify the image sizes and are not developer, you’ll want to give a try to this plugin.


 

//Default images sizes
        $this -> tc_thumb_size      = array('width' => 270 , 'height' => 250, 'crop' => true );
        $this -> slider_full_size   = array('width' => 99999 , 'height' => 500, 'crop' => true );
        $this -> slider_size        = array('width' => 1170 , 'height' => 500, 'crop' => true );


//post thumbnails for featured pages and post lists (archive, search, ...)
      $tc_thumb_size    = apply_filters( 'tc_thumb_size' , $this -> tc_thumb_size );
      add_image_size( 'tc-thumb' , $tc_thumb_size['width'] , $tc_thumb_size['height'], $tc_thumb_size['crop'] );

      //slider full width
      $slider_full_size = apply_filters( 'tc_slider_full_size' , $this -> slider_full_size );
      add_image_size( 'slider-full' , $slider_full_size['width'] , $slider_full_size['height'], $slider_full_size['crop'] );

      //slider boxed
      $slider_size      = apply_filters( 'tc_slider_size' , $this -> slider_size );
      add_image_size( 'slider' , $slider_size['width'] , $slider_size['height'], $slider_size['crop'] );

Important : Customizr-Pro and Featured Pages Unlimited users must use the filter ‘fpc_size’ to change the featured pages image sizes.

For example, if you need to change the thumbnail size, use the following code with your own new dimensions/cropping options

add_filter( 'tc_thumb_size', 'my_thumb_size');
function my_thumb_size() {
    $sizeinfo = array( 'width' => 270 , 'height' => 200, 'crop' => false );
    return $sizeinfo;
}

Important : once you have added a new image size in Customizr, you need to refresh your images folder for the new size to be applied. For this, I recommend to use the very good Regenerate Thumbnails plugin (free).

 

Where to paste this code? => in your functions.php file. I strongly recommend to create a child theme. Download a start-up child theme here.

Everything you need to know about child theme with Customizr here.

More about image sizes in WordPress :

78 thoughts on “Changing the default image sizes in Customizr”

Comments are closed.