0

This has been asked before, but the answer is from three years ago and is not working for me, so I'm wondering if something fundamental has changed since then, or if I'm fundamentally misunderstanding something. I'm new at developing child themes.

I'm trying to do a child of a theme that is not supported by the creators (Duena). When I set the featured image for a page, add_image_size crops the image and I want to change that. Here's what's in the parent theme's functions.php:

function duena_setup() { 
// Various other things

if ( function_exists( 'add_theme_support' ) ) { // Added in 2.9
    add_theme_support( 'post-thumbnails' );
    set_post_thumbnail_size( 750, 290, true ); // Normal post thumbnails
    add_image_size( 'slider-post-thumbnail', 1140, 440, true ); // Slider Thumbnail
    add_image_size( 'image_post_format', 750, 440, true ); // Image Post Format output
    add_image_size( 'related-thumb', 160, 160, true ); // Realted Post Image output
    add_image_size( 'portfolio-large-th', 550, 210, true ); // 2 cols portfolio image
    add_image_size( 'portfolio-small-th', 265, 100, true ); // 4 cols portfolio image
}
}

For slider-post-thumbnail, I want the image height to be 600, or else set crop to false. I tried the solution in the other question by adding the following to my child theme's functions.php:

function hhc1_setup() {
    add_image_size( 'slider-post-thumbnail', 1140, 600, true ); // Slider Thumbnail
    }
add_action( 'after_setup_theme', 'hhc1_setup', 15 );

But, no dice, the featured images are still being cropped to 440 height. Am I missing something obvious?

  • 1
    Try to Regenerate Thumbnails - You can use this plugin wordpress.org/plugins/regenerate-thumbnails, This will create new thumbnail image for modified image size of existing images. – WisdmLabs May 28 '15 at 5:10
  • I just tried this plugin, and it's still not working -- I even removed the featured images from the pages and re-added them, regenerated thumbnails several times, but the output is still 440 for the height. Is there anything else that needs to be added to the child theme that I might have left out? – C McL May 28 '15 at 14:58
  • I just tried deleting the media files altogether and re-uploading them, and now I see that it's not cropping the image anymore -- it's got a height of 600 as I want -- but it's still displaying the image at the 440 height on the page, so now I'm assuming there's something in the stylesheet doing it. Thank you for the help on regenerating the thumbnails! – C McL May 28 '15 at 15:11
0

@WisdmLabs is right. For old images you will have to use that plugin to regenerate thumbnails. For new images which you will upload it will respect the 600 height mentioned in child theme's functions.php file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.