How To Reduce Image Size Generation

More About Child Themes
View The WordPress Codex Docs

The Avada theme generates image sizes for the most important areas, so that images of appropriate sizes can be loaded on the frontend instead of always loading the full image size. It may seem like a lot of images, but this reduces loading time considerably on the front end for your viewers. We feel the performance increase is well worth the extra image files. If you would like to change this to suit your needs however, please read the information below.

Locate Current Image Sizes

Before you can reduce your image sizes in your child theme, you must first locate them in the files so you know the exact image slug to target. The add_image_size() functions are located in two files:

Avada -> wp-content/themes/Avada/includes/class-avada-init.php

Fusion Core -> wp-content/plugins/fusion-core/fusion-core.php

To easily locate this, just do a text search in the file for add_image_size.

Once you’ve found the image size function, you can copy out the image size slug that you’re wanting to remove, for use in your child theme’s function.

Note: The “portfolio-five” image size is used for not only the five column portfolio layout, but is also used in the Recent Posts element’s “Thumbnail on Side” layout.

Avada -> wp-content/themes/Avada/includes/class-avada-init.php

Copy to Clipboard

Fusion Core -> wp-content/plugins/fusion-core/includes/class-fusioncore-plugin.php

Copy to Clipboard

Modify Your Child Theme

Now that you have the slug for the image size you would like to remove, it’s time to move to your child theme.

Step 1 – Go into your child theme folder and open the functions.php file. If you don’t have this file, simply create one with the same filename.

Step 2 – At the very bottom, add this action:

Copy to Clipboard

Step 3 – Replace the value ‘blog-large’ inside remove_image_size( ‘blog-large’ ); with the image slug of your desired image size.

Step 4 – If you’d like to remove more than one image sizes, copy this action and paste it inside the same my_custom_remove_image_size() function and change the necessary value accordingly:

Copy to Clipboard

Step 6 – If needed, run the Force Regenerate Thumbnails plugin to regenerate your thumbnails.