Archived topic
The theme is not generating any thumbnails
25 replies · Started by Shrawan on February 5, 2020
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 ?
No David, don't think so. We have not added anything other that what you have recommended on the 5th of February on this thread.
Do you still have this code here?
https://generatepress.com/forums/topic/the-theme-is-not-generating-any-thumbnails/#post-1157575
If so can you temporarily remove that and let us know.
I have added the code you gave me, excluded the old code (As you advised) but I still see the same single LCP issue
I 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.
Hi 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.
The 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.
David 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
The previous code i gave you fixed the Single Posts issue. So you need to keep that as well.
Hi David, not sure what you are referring to - the GooglePageSpeed test for single post still has the LCP issue, despite us adding your code.
FCP 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.