Skip to content

Instantly share code, notes, and snippets.

@websupporter
Last active March 16, 2016 11:49
Show Gist options
  • Save websupporter/ccfc45681e7c5ad7800f to your computer and use it in GitHub Desktop.
Save websupporter/ccfc45681e7c5ad7800f to your computer and use it in GitHub Desktop.
<?php
/**
* If you have already included Gist as a handler, you could
* use this Snippet to include the raw output as iframe...
* ... if... well if github would permit it... but
* just for demonstration purposes.
* **/
add_filter( 'embed_handler_html', 'fwe_embed_handler_html', 10, 4 );
function fwe_embed_handler_html( $html, $url, $attr, $post_ID = null ){
if( ! preg_match( '/https:\/\/gist\.github\.com\/(.*)\/(.*)\/?/i', $url, $matches ) )
return $html;
return '<iframe src="https://gist.githubusercontent.com/' . $matches[1] . '/' . $matches[2] . '/raw/"></iframe>';
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment