0

How do I increase the height of the featured images on my (blog page)? I have tried modifying the existing code:

add_image_size( 'featured-blog-large', 750, 350, true );

But using this method, I can only manage to shrink the height of the featured images. If I try to set a height larger than 350 px the page still restricts the image to 350 px in height. Perhaps there are other forces restricting this height?

My Testing So Far

  • As a test, I edited the theme's code to specify a smaller height:

    add_image_size( 'featured-blog-large', 750, 200, true );

    When I did so, the images were indeed scaled down to that size, as expected.

  • The issue occurs when I try to scale the theme code up to a height larger than 350 px:

    add_image_size( 'featured-blog-large', 750, 500, true );

    This results in the image being scaled down to 750 x 350 px (as currently seen on the blog page). An additional curiosity is that this image is scaled, instead of cropped--I would expect it to be cropped, since the $crop parameter is set to true.

  • When I inspect the featured image, the img tag has a height set to auto. But there is a separate greyed out entry, img[Attributes Style], which has a height and width. That height is set to 350 px and the width set to 750 px, but the height is in strikethrough font (screenshot). This is the case regardless of the size of the image, the parameters of add_image_size(), or even the presence of add_image_size().

1 Answer 1

0

I determined why I was observing this behavior. It appears that, even though I am telling WordPress to display a 750 x 500 px image, it is displaying its own scaled version of the image, which is 750 x 350 px. I have to now go determine why WordPress is doing this. For now though, I can consider this particular question answered.

I still don't understand the img[Attributes Style], but since it is secondary to my issue, I won't worry about it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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