Created
June 15, 2015 04:45
-
-
Save zgordon/1fbec6fffc2e9888e332 to your computer and use it in GitHub Desktop.
oEmbed Gist into WordPress
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
wp_embed_register_handler( | |
'github-gist', | |
'/https:\/\/gist\.github\.com\/([^\/]+)\/([^\/]+)/', | |
function($matches, $attr, $url, $rawattr) { | |
$embed = "<script src=\"{$url}.js\"></script>"; | |
return apply_filters( | |
'embed_github_gist', | |
$embed, | |
$matches, | |
$attr, | |
$url, | |
$rawattr | |
); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment