-
-
Save Irfan-Ansari/55225a901e099acd9007 to your computer and use it in GitHub Desktop.
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 THEMENAME_wrap_gumby_intrinsic($html, $url, $args){ | |
$provider = ''; | |
if (preg_match("#https?://youtu\.be/.*#i", $url) || preg_match("#https?://(www\.)?youtube\.com/watch.*#i", $url)) { | |
$provider = 'youtube'; | |
}elseif (preg_match("/vimeo.com\/([^&]+)/i", $url)) { | |
$provider = 'vimeo'; | |
} | |
//no oEmbed for Twich :< | |
//elseif (preg_match("/https?:\/\/(.*twitch\.tv\/.*|.*twitch\.tv\/.*\/b\/.*)/i", $url)){ | |
//$provider = 'twitch'; | |
//} | |
$html = "<div class='video ".$provider."' >". $html . "</div>"; | |
return $html; | |
} | |
add_filter( 'embed_oembed_html', 'THEMENAME_wrap_gumby_intrinsic', 10, 3); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment