Support » Plugin: Lazy Loader » lazyload videos/iframes through oembed

  • one more thing 😉

    how about lazyloading iframes that are inserted via oembed (like, i.e. by using the ACF oembed field)? 🙂

    add_filter( 'embed_oembed_html', function ( $cached_html, $url, $attr, $post_id ) {
    
    	// logic to parse $html in order to add lazyload class for iframes
    	$cached_html = modify_iframe_oembed_markup( $cached_html );
    
    	return '<div class="fluid-embed">' . $cached_html . '</div>';
    
    }, 99, 4 );
    add_filter( 'oembed_dataparse', function ( $output, $data, $url ) {
    
    	// logic to parse $html in order to add lazyload class for iframes
    	$output = modify_iframe_oembed_markup( $output );
    
    	return '<div class="fluid-embed">' . $output . '</div>';
    
    }, 90, 3 );
Viewing 1 replies (of 1 total)
  • Plugin Author Florian Brinkmann

    (@florianbrinkmann)

    Hey 🙂

    good idea, I already thought about supporting ACF fields some time ago, but I did not follow up on that.

    To the oEmbed: hm, it already works for things like embedding a post into another, maybe the ACF action runs later.

    I will look into it! 🙂

    Best,
    Florian

Viewing 1 replies (of 1 total)
  • The topic ‘lazyload videos/iframes through oembed’ is closed to new replies.