[Resolved] First image lazy load exclusion

Home Forums Support [Resolved] First image lazy load exclusion

Home Forums Support First image lazy load exclusion

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #2082246
    maxime

    Hello,

    I would like to not lazy load the first image (or featured image) on every page as I saw in this post.
    So I copied and paste the PHP Snippet but it doesn’t work, I think I have to do something with the CSS but I didn’t understand how or where.

    The PHP Snippets is actually active, just to let you know.

    If there’s another way to do it, please let me know too.

    Thanks for your help.

    #2082396
    Leo
    Staff
    Customer Support

    Hi there,

    That script is to add the class first-featured-image to the featured image and it’s indeed working:
    https://www.screencast.com/t/tOQBBYrtmMKn

    Then you just need to add first-featured-image to the exclusion of whatever plugin you are using to perform lazy-load.

    The theme itself doesn’t have any lazy loading feature built-in so it must be from a plugin.

    You can check with the plugin support for further info if needed.

    #2084925
    maxime

    Hello Leo, sorry for the late reply I didn’t check back.

    Thank you I understand now how the code works πŸ™‚

    I’m using imagify but I don’t see any lazy load option and for the plugin autoptimize, in the image section I didn’t check any box about image optimization nor the lazy load.
    Which mean that I think my image are being lazy load automatically by WordPress now that they do that and we don’t need any plugin.
    By any chance would you know how I can exclude then the first image lazy load not caused by a plugin?

    Thanks

    #2084989
    Ying
    Staff
    Customer Support

    Hi Maxime,

    It looks like you are using WP fastest cache plugin, can you check if it has lazy load options?

    And for Autoptimize, you can find its lazyload settings at settings > Autoptimize > images, you can see the exclusions options there.

    #2084996
    maxime

    Hello Ying,

    For WP fastest cache it’s unchecked and I can’t even check it cause I don’t have the premium plan haha
    But for Autoptimize it means I would have to activate the lazy load to then exclude the class first-featured-image ?
    Because right now my lazy load are just from WordPress itself.

    #2085008
    Leo
    Staff
    Customer Support

    Because right now my lazy load are just from WordPress itself.

    Hmm in that case can you check with WordPress’ support team to see if they can help to exclude certain images from being lazy loaded?

    I did a quick research but can only find this:
    https://www.wppagebuilders.com/disable-lazy-load-in-wordpress-5-5/

    #2085015
    maxime

    Understood Leo, thank you for your help.
    And Ying to let you know that it’s working when autoptimize activated and the class Leo told me excluded.

    Anyway I looked in case of in your link.

    Thank you both, have a nice day.

    #2085019
    Ying
    Staff
    Customer Support

    You can try a plugin to disable WordPress native lazy load: https://wordpress.org/plugins/disable-lazy-loading/

    Or give this filter a try to disable WP lazy load:
    add_filter( 'wp_lazy_loading_enabled', '__return_false' );

    As it’s not a GP issue, it’s better to reach out to WP support.

    I did some Googling, this article should be helpful: https://wphelp.blog/how-to-selectively-disable-lazy-load/

    #2085020
    maxime

    Thank you Ying I’ll try that first πŸ™‚

    #2085021
    Leo
    Staff
    Customer Support

    And Ying to let you know that it’s working when autoptimize activated and the class Leo told me excluded.

    Hmm in that case I would assume Autopimize is responsible for the lazy loading and not WordPress.

    Glad to hear it’s working for you though!

    #2085030
    maxime

    Yes I activated the lazy loading from autoptimize to try its exclusion, and it’s working πŸ™‚
    So I think I’ll have to disable the native lazy load from WordPress

    #2085032
    Leo
    Staff
    Customer Support
Viewing 12 posts - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.