Archived topic
Image Lazy-Load Exclusion Filter Modification
2 replies · Started by Puneet on December 12, 2021
Hi
I disabled the featured image to show within a single post and added the same image in its place as entry content. The performance of that page improved hugely. I don't understand why, but it went from 84 to 97 on Google Page Insights. The problem is now it's being lazyloaded. Would you please modify the filter to exclude the first image added manually on the posts from lazyloading? I would start adding images manually instead of featured images showing in a single post with this much benefit. This was the filter code earlier:-
“// Add first-featured-image ( or any class ) to featured image of latest post
function skip_lazy_class_first_featured_image($attr) {
global $wp_query;
if ( 0 == $wp_query->current_post ) {
$attr[‘class’] .= ‘ first-featured-image’;
}
return $attr;
}
add_filter(‘wp_get_attachment_image_attributes’, ‘skip_lazy_class_first_featured_image’ );”
Screenshot: https://snipboard.io/RYFNdp.jpg
URL: https://geekyfi.com/movies/mary-elizabeth-winstead-is-atomic-in-netflixs-kate/
I would need to exclude the first image on the front page as well. :- https://geekyfi.com/
I had asked the same question in an already resolved thread. However, I wasn't sure that was the right approach, hence opening a new thread. Sorry if this added confusion.
Regards,
Puneet
Hi there,
i replied to your original topic :)
Closing this one as its being followed up on a separate thread. Thanks