- This topic has 25 replies, 2 voices, and was last updated 3 years, 8 months ago by David.
-
AuthorPosts
-
July 20, 2020 at 7:17 am #1369603DavidStaffCustomer Support
The function i provided here should add the
no-lazy
class to the featured image. But it is not which means something else is changing the img html.Do you have any other functions that are related to Images ?
July 20, 2020 at 1:58 pm #1370101ShrawanNo David, don’t think so. We have not added anything other that what you have recommended on the 5th of February on this thread.
July 21, 2020 at 12:14 am #1370414DavidStaffCustomer SupportDo you still have this code here?
https://generatepress.com/forums/topic/the-theme-is-not-generating-any-thumbnails/#post-1157575If so can you temporarily remove that and let us know.
August 10, 2020 at 10:15 am #1395848ShrawanI have added the code you gave me, excluded the old code (As you advised) but I still see the same single LCP issue
August 11, 2020 at 8:07 am #1397313DavidStaffCustomer SupportI can see the class is being added to the img on your single post. And it is no longer subject to the Lazyloader. I ran a lighthouse report and the CLS was
0
On the front page the CLS is very little – but all of the elements listed are fonts. And you can see a slight FOUT when loading. This will be related to your font loading and any optimizations you’re using for them.
August 12, 2020 at 8:45 am #1399171ShrawanHi David, the issue is with LCP, not CLS – when you run the GooglePageSpeed test on the homepage, we have the LCP as one of the issues which need correction, which is why I opened this ticket.
August 12, 2020 at 9:20 am #1399229DavidStaffCustomer SupportThe lazy loader is affecting the the first post image which is your largest element.
Try adding this function:function db_add_class_to_first_in_loop_featured_image($attr) { remove_filter('wp_get_attachment_image_attributes','db_add_class_to_single_featured_image'); global $wp_query; if ( !is_single() && 0 == $wp_query->current_post ) $attr['class'] .= ' skip-lazy'; return $attr; } add_filter('wp_get_attachment_image_attributes','db_add_class_to_first_in_loop_featured_image');
It should add the
skip-lazy
class to the featured image of the first post.August 12, 2020 at 9:27 am #1399236ShrawanDavid we’ll add what you’ve given us, but should we first disable what you already gave us here? – https://generatepress.com/forums/topic/the-theme-is-not-generating-any-thumbnails/#post-1157575
August 12, 2020 at 9:35 am #1399251DavidStaffCustomer SupportThe previous code i gave you fixed the Single Posts issue. So you need to keep that as well.
August 12, 2020 at 9:37 am #1399256ShrawanHi David, not sure what you are referring to – the GooglePageSpeed test for single post still has the LCP issue, despite us adding your code.
August 12, 2020 at 9:46 am #1399274DavidStaffCustomer SupportFCP measures the time taken to display the first pixel.
LCP is the time it takes for the largest element to be displayed.
On your single post you will see there is 1. Largest Contentful Paint element
This is the featured image.This is not an Error – all it is telling you is the LCP time is based on HOW LONG that element took to load.
The first code i gave you stopped it from being lazy loaded. Which means is should have a lower LCP and also the user doesn’t see an empty white space when it first loads.
The second code i gave you will do the exact same thing for the first post in your loop.
-
AuthorPosts
- You must be logged in to reply to this topic.