Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi,

    I found a way.
    You can remove lazyload images filters on specific pages or templates, etc.

    
    /**
     * Remove lazyload images filter.
     * Use 'wp' hook because Lazyload instance is loaded in the same hook and we need to use WP conditional tags.
     */
    function exclude_template_lazyload() {
        $A3_Lazy_Load = A3_Lazy_Load::_instance();
    
        if ( is_page( 'my-page' ) ) {
    	remove_filter( 'the_content', array( $A3_Lazy_Load, 'filter_content_images' ) );
            remove_filter( 'widget_text', array( $this, 'filter_images' ), 200 );
            remove_filter( 'post_thumbnail_html', array( $this, 'filter_images' ), 200 );
            remove_filter( 'get_avatar', array( $this, 'filter_images' ), 200 );
        }
    }
    add_action( 'wp', 'exclude_template_lazyload' );

    Sorry, forgot to mention,
    you have to use it with another filter mentioned in other thread.

    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_page_template('template-map.php') ) {
    		$apply_lazyload = false;
    	}
    	return $apply_lazyload;
    }
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How can i deactivate a3 Lazy Load on some pages?’ is closed to new replies.