Support » Theme: Olsen Light » How to Set Featured Images as the size as they are

  • Resolved barrelleaf

    (@barrelleaf)


    Hi, I used to use a plugin for the featured images, but I’m planning to change it back soon.

    I usually use 680*907 as my featured images’ size, so I’ve changed the
    set_post_thumbnail_size( 665, 435, true );

    to
    set_post_thumbnail_size( 680, 907, true );

    but it’s not working.

    And considering I use different sizes for featured images occasionally, I’m wondering that is there any way to set the featured images as they are.

    Thank you.

    • This topic was modified 2 months, 1 week ago by  barrelleaf.

    The page I need help with: [log in to see the link]

Viewing 13 replies - 1 through 13 (of 13 total)
  • Hello there!

    Did you regenerate your thumbnails after modifying the thumbnail size?

    Hi Nik @nvourva,

    I did regenerate the thumbnails, but it still does not work.

    And when I just want to try to test by regenerating one thumbnail of a post, it shows that my image doesn’t fit the 680*907 I set. However, the image is exactly 680*907, so I don’t know where goes wrong…

    I’m also thinking is there any way to use CSS to set the thumbnail size instead of PHP in functions.php? cus I’m worried about the updates in the future will wipe out all the modifications I made. BTW, I’m using a child theme right now.

    Thank you.

    Image sizes can’t be set via CSS I’m afraid, however using a child theme is the proper way to apply modifications, well done there. You don’t have to worry about theme updates undoing your modifications because the child theme will preserve them.

    Now, since you are using a child theme try modifying the post thumbnail size by adding this to your child theme’s functions.php file

    function child_theme_setup() {
       set_post_thumbnail_size( 680, 907, true );
    }
    add_action( 'after_setup_theme', 'child_theme_setup', 11 );

    and then regenerate the thumbnails.

    barrelleaf

    (@barrelleaf)

    Hi, thanks for replying.

    I’ve added the scripts you provided in the functions.php and regenerated the thumbnails, but it still doesn’t work.

    The thumbnail size is still 665 x 435 pixels.

    I’m wondering that whether it’s me that I put it wrong or something.
    I took a screenshot and place it here.

    Hope that you could take a look and maybe find something wrong for this issue.
    Thank you.

    Did you manage to fix this? I have just checked this post https://www.barrelleaf.com/taro-sesame-oil-sticky-rice/ and the featured image there is indeed 680×907

    barrelleaf

    (@barrelleaf)

    I haven’t fix it. I’m using a plugin right now (Featured Image from URL), so it shows up as the URL image size. I tried this morning and it still does not work when I used the original featured image column.

    That looks ok.

    I have just double checked this locally and it works as expected. I am able to modify the post thumbail size via the action mentioned above.

    Are you using this plugin https://wordpress.org/plugins/regenerate-thumbnails/ to regenerate the thumbnails? If yes, can you please find the above post’s featured image and click to regenerate just that one? Then see what image size does it report for the post thumbnail?

    barrelleaf

    (@barrelleaf)

    Hi Nik,
    I did use that plugin and tried to regenerate the thumbnail for the single post.
    I tried it again but it still doesn’t work, as you can see here.

    The size for the thumbnail is still 665 x 435 pixels.

    I added some screenshots of my backend here, hoping they could give up some clues of what’s going wrong. 🙁

    What I see in the regenerate-thumbnail-2.png screenshot is what we would expect to see if our action was properly picked up from WordPress. As you can see in the post-thumbnail bit it sees that we need another image size and that the size is not currently available. Normally if at that moment you click the Regenerate thumbnails button above it should crop the images to the correct sizes and the red x mark will turn into a green check mark. What happens if you click the Regenerate thumbnails button? Does it turn green?

    barrelleaf

    (@barrelleaf)

    Hi Nik,

    I did click that regenerate button, but it just says “Done! Click here to go back” without any changes to the X mark.

    Here is the screenshot.

    barrelleaf

    (@barrelleaf)

    Hi Nik.
    After a few testing and trying, I finally figure it out.
    I need to check the “thumbnail files for old unregistered sizes” first, then choose the thumbnail.

    Simply put, I need to delete the old thumbnails first and choose the featured images again to make that work. The regenerate button alone doesn’t work… Orz

    • This reply was modified 2 months ago by  barrelleaf.

    That’s great news. Glad to hear you were able to resolve this, and thank you for sharing the solution.

    If you like you can mark this post as resolved.

    Thank you.

    It seems that I need to modify each post one by one.
    Anyway, thank you for your help.

Viewing 13 replies - 1 through 13 (of 13 total)
  • You must be logged in to reply to this topic.