Support » Plugin: Jetpack by WordPress.com » how to apply filter lazyload_is_enabled

  • Resolved clockwood

    (@clockwood)


    I’m working with JetPack for the first time and having some issues with Lazy Loading images messing up a layout, so I want to disable it on a few pages.

    The docs say to use apply_filters( ‘lazyload_is_enabled’, false ); I’m not a developer, and I’m not familiar with hooking into filters. I fumbled around a bit to no avail, so I could use some advice on how to set this up to disable lazy loading on a few pages.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support dougaitken

    (@dougaitken)

    Automattic Happiness Engineer

    Hi @clockwood

    Thank you for reaching out to us about enabling lazyload on specific pages, let me point you in the right direction.

    When you mention docs, do you mean https://developer.jetpack.com/hooks/lazyload_is_enabled/ ?

    A function hooked in post-query so the is_*() functions are available and then if it is a certain post, then filter false that filter.

    If you need some help, I’d recommend asking a developer for some help as we don’t offer support for customizations like this.

    You can find the help here: https://jetpack.pro/ or https://jobs.wordpress.net/

    Thanks,

    ecotechie

    (@seedsca)

    I was having the same problem. This is what I did to fix the issue. Jetpack did not make this very clear in their documentation…

    add_filter( 'lazyload_is_enabled', 'echotechie_lazyload_exclude', 15 );
    function echotechie_lazyload_exclude() {
    	if ( is_page( array( 12, 'slug', 'Title' ) ) ) {
    		return false;
    	} else {
    		return true;
    	}
    }

    Now just change the 12, ‘slug’, ‘Title’ to whatever page you want to exclude from lazy loading 😉

    Or remove the whole array() and add a single field.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘how to apply filter lazyload_is_enabled’ is closed to new replies.