Wordpress Featured Image Resize Aaaaaaaaah!

Hi there. Hope someone can help. All of a sudden my featured image at the top of a post has gone massive and I want to resize it. It’s driving me a bit mad. It should be such an easy thing to do but it’s not.

So far I have something like this, which does resize it but I know want to center it now as it is left aligned. I hear you can also do something with post_image_thumbnail or something like that.

If someone can help / point in the right direction. Here is a link (no changes made on this)

.entry-thumbnail, .header-image {
background-repeat: no-repeat;
background-size: cover;
left: 0;
top: 0;
width: 70%;
z-index: 0;
}

Thanks in advance.

WordPress has added height and width attributes to the image which will override your rules. You would need to remove the attributes with JavaScript or with a hook in the theme or your CSS will take second fiddle to the inline definitions.

But…it is much better to load a smaller image in the first place. The theme is probably loading the image with the_post_thumbnail() which has a parameter that specifies the size to use.

You can add your own sizes to the theme with add_image_size().

There may also be a place to change the image sizes in the WordPress settings.

Good Luck,
Michael

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.