0
votes

I'm creating a child theme from a parent theme in Wordpress. I would like to change the defined image sizes in the parent's functions.php file:

/* Image sizes */
add_action( 'init', 'oxygen_image_sizes' );   

/**Image sizes**/
function oxygen_image_sizes() {  
add_image_size( 'archive-thumbnail', 470, 140, true );
add_image_size( 'single-thumbnail', 470, 260, true );
add_image_size( 'featured-thumbnail', 750, 380, true );
add_image_size( 'slider-nav-thumbnail', 110, 70, true );
}    

Here is a link that I found that seems pretty straightforward but it's not working for me. https://wordpress.stackexchange.com/questions/74934/remove-or-update-add-image-size

Here is the code that I'm using in my child theme's functions.php file:

function child_theme_setup() {
add_image_size( 'archive-thumbnail', 600, 140, true );
add_image_size( 'single-thumbnail', 600, 260, true );
add_image_size( 'featured-thumbnail', 600, 380, true );
}
add_action( 'after_setup_theme', 'child_theme_setup', 11 );  

Many thanks!

1

1 Answers

0
votes

The Hook after_setup_theme is called before init.

So your settings get overwritten by the settings from the parent theme.

You can also use init to hook into and with the higher priority (11) your setting will be used.

OR

You remove the oxygen_image_sizes-action and re add all the image-sizes with your own function.