• Is it possible to add feature to set numebr of images (1,2,…) to dynamically exclude above the fold images from loading lazy?

    • This topic was modified 1 year, 11 months ago by yoyurec.
Viewing 1 replies (of 1 total)
  • Thread Starter yoyurec

    (@yoyurec)

    Snippet for

    // Exclude above the fold images
    function add_lazy_exclude_class( $content ) {
    $content = preg_replace('/class="wp-image/', 'class="no-lazyload wp-image', $content, 1);
    return $content;
    }
    add_filter( 'the_content', 'add_lazy_exclude_class', 0 );

Viewing 1 replies (of 1 total)
  • The topic ‘Exlude N images from lazy loading’ is closed to new replies.