Are you regenerating thumbnails after the changes? Images thumbnail sizes are physically (digitally) created based on the functions you mentioned. So if certain dimensions are used to create thumbnails from a specific image, and then you change those dimensions, new thumbnail sizes need to be created based the new dimensions.
Install and activate Regenerate Thumbnails and give it a run (Tools menu). It’ll read your new functions, delete the old thumbnail sizes (but keep the original image), and then use the original image to generate new thumbnails. Clear your cache and refresh after that.
Thread Starter
bdam6
(@bdam6)
No it didn’t work. To be honest, I didn’t think that that was gonna work cause I didn’t change the media settings. I just added a post thumbnail size and changed the page.php and content.php for which size to call. Also this does work on my other sites, but Twenty Thirteen seems not to respond…
Thank you anyways!
Thread Starter
bdam6
(@bdam6)
Oh btw I did see that the page.php gives the room for the size I want, but it just doesn’t resize my image. Even though I’ve set ‘true’…
Just FYI, changing the media settings and adding the function to change the thumbnail sizes will do the same thing. So Regenerate Thumbnails is necessary for either case, though the plugin description doesn’t mention the manual method.
I think I see what the problem is. For your ‘page-header’ featured images, you don’t have to add add_theme_support() and set_post_thumbnail_size() to your functions.php file. Theme support for featured images is already added and you’re not changing the dimensions of the default featured images. You’re adding a new size.
Use add_image_size() as a replacement for the two functions you were using.
add_image_size( 'page-header', 1000, 300, true );
Then in the template files, use the_post_thumbnail('page-header');. Let me know if that works out as expected.
Thread Starter
bdam6
(@bdam6)
Yes it worked!!! I don’t get it cause I’ve tried that code too. But I tried so many things that I probably got something mixed up! Thank you so much !!!
Haha I do that a lot too. Sometimes I just have to wipe it all clean and start from scratch again. Glad it’s working! π
Thread Starter
bdam6
(@bdam6)
Hahaha I’ve been starting from scratch too many times;) Finally done π
Thread Starter
bdam6
(@bdam6)
I just got it wrong again, deleted codes that I thought were unnecessary, so for everyone running into the same problem, this is what worked for me!
In functions.php add this code, fill in what the name of your new image size is. Mine is post-thumbnails. Then width and height. After that true or false if you want to hard crop!
add_theme_support( ‘post-thumbnails’ );
set_post_thumbnail_size(‘post-thumbnails’, 400, 300, true );
add_image_size( ‘post-thumbnails’, 400, 300, true );
Then in any php file where you want to change the size of the featured image you look up this code:
<?php the_post_thumbnail(); ?>
And add the name of the size you want to show like this:
<?php the_post_thumbnail(‘post-thumbnails’); ?>
I changed content.php, page.php and I added a new content.php file for my homepage. I added 3 different sizes and it finally worked, mainly cause of sdavis2702!