- This topic has 5 replies, 3 voices, and was last updated 6 months, 3 weeks ago by Elvin.
March 1, 2021 at 10:59 pm #1678260Vera
the page speed test is warning me that my logo and images within WP Show Posts don’t have explicit width and height set. I saw somewhere else on the forum that you suggested removing the retina logo (I don’t have the retina logo enabled), and for WP Show Posts to add height and width (and I did, but the warning is still there). Can you please help me solve this issue? Thanks!March 2, 2021 at 8:56 am #1679089DavidStaffCustomer Support
see the reply here:March 2, 2021 at 10:58 pm #1679755Vera
Hi David, thanks for your reply. However, I am not sure it solves my problem. I don’t have a problem with resizing the images. I have a problem with WP Show Posts images and my header logo not passing Page Speed Insight Test, because the warning they return is “image elements don’t have explicit width and height”. I found another thread with similar problem here: https://generatepress.com/forums/topic/use-explicit-width-and-height-on-image-elements-issue-in-gtmetrix/ . However, the solutions offered there don’t seem to fix the problem for me. I don’t have the retina logo enabled, and I tried adding height and width within WP Show Posts settings, but the warning is still there.
Thanks again!March 2, 2021 at 11:26 pm #1679770ElvinStaffCustomer Support
Let’s break things down a bit to properly address the issue/s.
While the images are flagged under one issue on Google PSI, There’s actually 2 separate things here.
One is the theme’s logo.
Your specific site has 2 logo versions, one for mobile and one for desktop.
For mobile, you can add the image height and width by filtering it using the
For the desktop version of the logo, you can add in the height and width attribute by using my snippet here:
Now, as for the WP Show Posts images:
There’s an alpha version in development that reworked how the images are added and resized.
See changelog here: https://wpshowposts.com/wp-show-posts-1-2-0/
The beta version you can use on live sites will be released next week.
As for the current official release (1.1.3):
The way to go is to NOT use the image width and height fields. As I’ve explained on David’s link, usage of image width and height fields removes the width and height attributes of the image and instead, generates a new image file with a size based on the specified width and height on the image width and image height text field on the WPSP list.
This causes the “Image elements don’t have explicit width and height” on WPSP. And is actually reworked on the alpha version to prevent this from happening.
If you wish to resize the image, use CSS rather than the WPSP image height and image width text fields to avoid this issue.
A wise man once said:
"Have you cleared your cache?"March 4, 2021 at 2:32 am #1681492Vera
Thanks Elvin! Snippets worked for the logo, and for WPSP I will wait the release of an updated version next week. Thanks again!
veraMarch 4, 2021 at 3:05 pm #1682526ElvinStaffCustomer Support
You can check WPSP’s changelog page from time to time to check if the outdate is up.
A wise man once said:
"Have you cleared your cache?"
- You must be logged in to reply to this topic.