Skip to content

Instantly share code, notes, and snippets.

@ottanxyz ottanxyz/functions.php
Last active May 8, 2016

What would you like to do?
wp_embed_register_handler( 'gist', '/https?:\/\/gist\.github\.com\/([a-z0-9]+)\/([a-z0-9]+)(#file=.*)?/i', function( $matches, $attr, $url, $rawattr ) {
$embed = sprintf(
'<script src="$s/%2$s.js"></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
You can’t perform that action at this time.