Created
February 19, 2018 19:34
-
-
Save robobobo/937e477ffaf59ea3f65762d3c5620d8a to your computer and use it in GitHub Desktop.
How to add a div around Wordpress embeds using the oembed filter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function worpress_responsive_embeds($html) | |
{ | |
if (stripos($html, "twitter") !== FALSE || stripos($html, "facebook") !== FALSE) { | |
return '<div class="social-embed-container">' . $html . '</div>'; | |
} | |
else { | |
return '<div class="video-container">' . $html . '</div>'; | |
} | |
} | |
add_filter('embed_oembed_html', 'wordpress_responsive_embeds', 10, 3); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment