Skip to content

Instantly share code, notes, and snippets.

@Irfan-Ansari
Forked from PunchRockgroin/functions.php
Last active August 29, 2015 14:21
Show Gist options
  • Save Irfan-Ansari/55225a901e099acd9007 to your computer and use it in GitHub Desktop.
Save Irfan-Ansari/55225a901e099acd9007 to your computer and use it in GitHub Desktop.
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