Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Theme-based oEmbed support for Wordpress multisite installations.
// We use to help with oembeds that aren't very clean
// Define our API KEY
// remove default polldaddy provider because its broken
// this can be removed when WP removes support for polldaddy
// see
wp_oembed_remove_provider( '#https?://(.+\.)?polldaddy\.com/.*#i' );
$regex_patterns = file(dirname( __FILE__ ).'/embedly_patterns.def');
foreach ($regex_patterns as $regex) {
wp_oembed_add_provider($regex, ''.EMBEDLY_KEY, true);
* Make oEmbed Videos Responsive
* Adapted from Responsive Video Embeds v1.1
* Uses Zurb Foundation Flex Video CSS Classes
* Only runs on things that are an iframe, object, or embed tag
* @return string
* @link
* @link
function modify_embed_output( $html, $url, $attr ) {
if ((stripos($html,'<iframe') !== false || stripos($html,'<object') !== false || stripos($html,'<embed') !== false) && stripos($html,'flex-video') === false )
return '<div class="flex-video">'.$html.'</div>';
return $html;
add_filter( 'embed_oembed_html', 'modify_embed_output', 9999, 3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment