[Resolved] Featured images in WPSP “do not have explicit width and height”

Please login to receive premium support.

Support for the free plugin can be found here.

Home Forums Pro Support Featured images in WPSP “do not have explicit width and height”

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #27769
    Simon
    Participant

    Hi

    When inspecting pages which include the WPSP displays of posts, Chrome Lighthouse returns the diagnostic that the Featured images displayed by WPSP “do not have explicit width and height“. It becomes a CLS problem.

    I have set the image width and image height in the WPSP list correctly, but it does not appear in the HTML. It is the same for all the WPSP lists.

    (Yet the same featured images do have explicit width and height in HTML when the post is viewed in full. Images within the wp-show-posts-entry-content do too.)

    I have added in the CSS: aspect-ratio: 2/1; object-fit: contain; But it requires the original width and height in the HTML for the image too.

    Please tell me how I make this work. (Examples at: https://aimh.uk/infant-mental-health-events-conferences/)

    Thank you!

    #27804
    elvin
    Moderator

    Hi there,

    This is a known issue when using the image width and image height fields on the WPSP settings on the current official version. I suggest you avoid using this as this removes the width and height attribute and crops the actual image file.

    We actually have an update for this but it’s still on alpha version so it’s not to be used for live sites. You can find the details here:
    https://wpshowposts.com/wp-show-posts-1-2-0/

    For now, the workaround for the current official release is to leave the image width and image height field empty and do the resizing on CSS.

    #27818
    Simon
    Participant

    Hi Elvin, Tom and team

    Thank you for being clear and up front about this, and offering a practical work-around. As always, that is hugely valuable and makes me respect GeneratePress and your plugins even more. Now I can just deal with it.

    Thank you!

    Simon

    #27846
    elvin
    Moderator

    Thank you for the kind words. We sincerely appreciate it.

    We’ll keep you posted on the updates. No problem. 🙂

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