WordPress.org

Ready to get started?Download WordPress

Forums

Twenty Thirteen
[resolved] Changing feature image sizes not responding (9 posts)

  1. bdam6
    Member
    Posted 3 months ago #

    Hello!

    I am working on adding some different feature image sizes for my twenty thirteen child theme. Wat works in all my other websites, fails to work in this theme. I don't get what I am doing wrong. I would love some help on this seeing as I need to finish this site soon.

    I've added several different codes in functions.php of my child theme. All of which are not working. For example:

    add_theme_support( 'page-header' );
    set_post_thumbnail_size(1000, 300, true);

    or

    add_theme_support( 'page-header' );
    set_post_thumbnail_size('page-header', 1000, 300 );

    And then I added at page.php or content.php

    "><?php the_post_thumbnail('page-header'); ?>

    or

    <?php the_post_thumbnail('page-header'); ?>

    -----------------------------------------------

    Just as a test I used the twenty thirteen default code for content.php and I changed the size of the default feature image in the twenty thirteen theme (not child) functions.php.

    But that didn't change the image size of the featured image.
    add_theme_support( 'post-thumbnails' );
    set_post_thumbnail_size( 604, 270, true );
    changed to:
    add_theme_support( 'post-thumbnails' );
    set_post_thumbnail_size( 1000, 270, true );

    Nothing happens. I am missing something because the theme is not responding to the resizing.

    Help me out?

  2. sdavis2702
    Member
    Posted 3 months ago #

    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.

  3. bdam6
    Member
    Posted 3 months ago #

    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!

  4. bdam6
    Member
    Posted 3 months ago #

    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'...

  5. sdavis2702
    Member
    Posted 3 months ago #

    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.

  6. bdam6
    Member
    Posted 3 months ago #

    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 !!!

  7. sdavis2702
    Member
    Posted 3 months ago #

    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! :)

  8. bdam6
    Member
    Posted 3 months ago #

    Hahaha I've been starting from scratch too many times;) Finally done :)

  9. bdam6
    Member
    Posted 3 months ago #

    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!

Reply

You must log in to post.

About this Theme

About this Topic