Overwrite Parent Theme add_image_size in Child Theme

I’m using a child theme of a parent theme. Now on my parent theme, theveloper adds some custom image sizes like this –

if ( function_exists( 'add_image_size' ) )
    {
        add_image_size( 'blog_feat_img', 1300 );
        add_image_size( 'latest_posts_widget_feat_img', 720 );
        add_image_size( 'portfolio_widget_feat_img_1x', 600 );
        add_image_size( 'portfolio_widget_feat_img_2x', 900 );
    }

Now I want to change the values is set default in my partent theme’s functions.php so searched Google and use every single alternative suggested there.

Starting with this:

I even tried to achieve it by doing this

update_option( 'blog_feat_img', 720 ); 

but no matter what I do the theme is still loading my parent theme’s add_image_size() values.

I’ve also written this following function to achieve this –

function img_update() {
    add_image_size( 'blog_feat_img', 720 );
    add_image_size( 'latest_posts_widget_feat_img', 400 );
    add_image_size( 'portfolio_widget_feat_img_1x', 400 );
    add_image_size( 'portfolio_widget_feat_img_2x', 800 );
}
add_action( 'after_setup_theme', 'img_update', 11 );

None of these is actually working. Any suggestions?

0

Leave a Comment