annelyse
12/4/2017 - 4:51 PM

Add responsive container to embeds video, iframe


( function( $ ) {
    $( "iframe" ).wrap( "<div class='embed-responsive embed-responsive-16by9'></div>" );
    $( "iframe" ).addClass('embed-responsive-item') ;

})(jQuery);

/*  Add responsive container to embeds
/* ------------------------------------ */ 


function wrap_oembed_html( $cached_html, $url, $attr, $post_id ) {
    return '<div class="embed-responsive embed-responsive-16by9">' . $cached_html . '</div>';
}
add_filter( 'embed_oembed_html', 'wrap_oembed_html', 99, 4 );