[Resolved] Image Lazy-Load Exclusion Filter Modification

Home Forums Support [Resolved] Image Lazy-Load Exclusion Filter Modification

Home Forums Support Image Lazy-Load Exclusion Filter Modification

  • This topic has 2 replies, 2 voices, and was last updated 1 month ago by Puneet.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #2046278
    Puneet

    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

    #2046655
    David
    Staff
    Customer Support

    Hi there,

    i replied to your original topic 🙂

    #2047515
    Puneet

    Closing this one as its being followed up on a separate thread. Thanks

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