Skip to content

Instantly share code, notes, and snippets.

@designbuildtest
Created August 11, 2015 20:31
Show Gist options
  • Select an option

  • Save designbuildtest/fd74d80a5ee9c651f131 to your computer and use it in GitHub Desktop.

Select an option

Save designbuildtest/fd74d80a5ee9c651f131 to your computer and use it in GitHub Desktop.
Gist oembed support.
function bhww_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 );
}
wp_embed_register_handler( 'gist', '/https?:\/\/gist\.github\.com\/([a-z0-9]+)(\?file=.*)?/i', 'bhww_embed_handler_gist' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment