Last active
October 6, 2015 09:48
-
-
Save madeinnordeste/2974890 to your computer and use it in GitHub Desktop.
Wordpress: gist plugin
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( 'gist', '/https:\/\/gist\.github\.com\/(\d+)(\?file=.*)?/i', 'wp_embed_handler_gist' ); | |
function wp_embed_handler_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( 'embed_gist', $embed, $matches, $attr, $url, $rawattr ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment