Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
/*
** Please get this plugin from the repo:
** https://github.com/SenpaiSilver/ShowMeYourGists
**
** This paste isn't always up to date.
*/
function embedGistsInPosts($post) {
$pat = '/<p>(https?:)\/\/gist.github.com\/(.*)\/(.*)<\/p>/mi';
$sub = '<script src="$1//gist.github.com/$2/$3.js"></script>';
$post = preg_replace($pat, $sub, $post);
return ($post);
}
add_action('the_content', 'embedGistsInPosts');
?>
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.