Last active
August 29, 2015 14:12
-
-
Save SenpaiSilver/0f775a6dac4807c4e97a to your computer and use it in GitHub Desktop.
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
<?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