By disabling Lazyload I mean to unregister it on that page template, which means the lazyload files are not loading on that page template. Is this not possible with the code above? Thank you.
At that stage (before content on a page) is too late, the pugin has already been activated.
You should put that code in functions.php and modify it by putting the condition by which you want the disable to take effect, inside the skip_a3_lazy_load_for_this_page function.
So,
1) put the code in functions.php
2) add the condition, for instance if you want to disable on post ID 123:
add_filter( 'a3_lazy_load_run_filter', 'skip_a3_lazy_load_for_this_page', 11 );
function skip_a3_lazy_load_for_this_page( $apply_lazyload ) {
if(is_single(123)){
$apply_lazyload = false;
}
return $apply_lazyload;
}
Hi,
Thanks.
That will still load css and js unfortunately. I would want those files not to be loaded on the page templates.
Does anyone know how to unload the (css, js)? Thank you!
-
This reply was modified 5 years, 9 months ago by maximmmus.
Hi Nguyen,
Thanks a lot! That is great news. Will you have a feature like this in the future?
* Feature – Add exclude from Lazy Load by page_template
That would be fantastic, because I use the same page_template on posts and pages and I also cannot exclude them by uri.
🙂 Thanks