Site logo

Archived topic

Customizing Feature Image Sizes

3 replies · Started by Philip on August 6, 2020

Viewing posts 1–4 of 4

I'm using a Header Element for my blog posts, and having an issue getting the featured image the size I need it. In the Element, I'm using:

{{custom_field._thumbnail_id}}

In functions.php, I added:

add_filter( 'generate_hero_thumbnail_id_size', function() {
    return 'large';
} );

This works as expected. However, I then went to Settings > Media and updated my "large" media size, but on the frontend, the size never changes. Do I need to regenerate my thumbnails or something?

I also tried creating a custom size to see if I could get around this. I tried:

add_action( 'init', function() {
    add_image_size( 'blog-featured-image', 2560, 1100, true );
} );

add_filter( 'generate_hero_thumbnail_id_size', function() {
    return 'blog-featured-image';
} );

But that must be an invalid approach because it doesn't seem to work at all.

Ultimately, what I'd love to be able to do is specify two slightly different featured image sizes for each of my two Header Elements, if that's possible.

Hi there,

Yes, whenever a size is changed (or added), thumbnails must be regenerated in order for WordPress to build the new sizes - it doesn't do it automatically, unfortunately.

Let me know if you need more info :)

Hi:
Is there an ideal feature image width or would that depend on the size (width) of your designated content area of the customizer? E.g. If you use 2 sidebars on homepage and 1 on the blog post, would the ideal image width For your post be the actual size of the width you set for your content (in pixels?
Howard

Hi Howard,

You are exactly right!

This archived topic is closed to new replies.