I have a filter working to wrap embed_oembed links in a responsive wrapper. See code.
add_filter('embed_oembed_html', 'wrap_embed_with_div', 10, 3);
function wrap_embed_with_div($html, $url, $attr) {
return '<div class="responsive-container">'.$html.'</div>';
}
The only problem is this also applies to everything else on the oembed list, i.e, twitter embeds, instagram, etc. I was trying to add an if statement, but have no luck. Basically, it would be great to just add this wrapper to video embeds like youtube/vimeo.
Here is what I got so far.
add_filter('embed_oembed_html', 'wrap_embed_with_div', 10, 3);
function wrap_embed_with_div($html, $url, $attr) {
if ($url == 'https://youtube.com'){
return '<div class="responsive-container">'.$html.'</div>';
}
else {
return $html;
}
}