Home > OS >  Wordpress Blog Image Resize
Wordpress Blog Image Resize

Time:08-26

Is there anyone who knows how to adjust the aspect ratio of a blog featured image on a Wordpress blog. The original image is 1500px x 1000px but the front end displays a cut off smaller version of this and only displays fully in a lightbox. I have tried css, changing thumbnail settings and played with theme settings... Unfortunately I cannot share links at this stage the site is still hidden to the public while in development. I have a feeling I will need to correct it with php?

screenshot of blog images

CodePudding user response:

How you get the image? Maybe you have to set the right size from default image sizes or define a new size and regenerate the thumbnail. Can you post the code you use to take the image?

You can use the image with a specific size

get_the_post_thumbnail_url(get_the_ID(),'your_image_size');

https://developer.wordpress.org/reference/functions/get_the_post_thumbnail_url/

and define a new size like this

add_image_size('your_image_size', 1000, 1500, true)

more here https://developer.wordpress.org/reference/functions/add_image_size/

CodePudding user response:

If the code is accessible you may define size in function call as Gozer mentioned.
OR
add_filter for post_thumbnail_html and modify the post thumbnail HTML as per your need.

  • Related