Created
July 13, 2014 04:14
-
-
Save kodango/4fd3af7f65365898ed87 to your computer and use it in GitHub Desktop.
embed-gist
This file contains hidden or 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
/* | |
* Embed gists with a URL in post article | |
*/ | |
function dangopress_embed_gist($matches, $attr, $url, $rawattr) | |
{ | |
$embed = sprintf( | |
'<script src="https://gist.github.com/%1$s.js%2$s"></script>', | |
esc_attr($matches[1]), | |
esc_attr($matches[2]) | |
); | |
return apply_filters('dangopress_embed_gist', $embed, $matches, $attr, $url, $rawattr); | |
} | |
wp_embed_register_handler('gist', '#https?://gist\.github\.com(?:/[a-z0-9-]+)?/([a-z0-9]+)(\?file=.*)?#i', 'dangopress_embed_gist'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment