Change Image Sizes in Child Themes

Change Image Sizes in Child Themes

22/06/2018
Click Here To Learn More About Child Themes
Click Here To View The WordPress Codex Docs

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 places: wp-content/themes/Avada/includes/class-avada-init.php and 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 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.

Child Theme Images
Child Theme Portfolio

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.

Child Theme Images Functions

Recent Posts

Recent Tweets

For privacy reasons Twitter needs your permission to be loaded. For more details, please see our Privacy Policy.
I Accept