How To Change Image Sizes in Child Themes

Last Update: March 5, 2024

Locate Current Image Sizes

Before you can modify 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

Avada Core -> wp-content/plugins/fusion-core/includes/class-fusion-portfolio.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 modify, 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

Avada Core -> wp-content/plugins/fusion-core/includes/class-fusion-portfolio.php

Copy to Clipboard

Modify Your Child Theme

Now that you have the slug for the image size you would like to change, 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 – In add_image_size( ‘blog-large’, width, height, true ); , replace the values with the exact same image slug and add your desired width and height values respectively. For example,

Copy to Clipboard

Step 5 – If you’d like to change more than one image size, copy these actions and paste them inside the same my_child_theme_image_size() function and change the necessary values accordingly:

Copy to Clipboard

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

In this article