Last active
December 11, 2015 16:08
-
-
Save freekrai/4625115 to your computer and use it in GitHub Desktop.
Embed Gists in wordpress via shortocde
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
// Place this code in your functions.php | |
// Then when you want to embed a gist, use [gist GISTID] and it will show up in your post | |
function embedGists( $atts ) { | |
$gist = $atts[0]; | |
$string = '<script src="https://gist.github.com/'.$gist.'.js"></script>'; | |
return $string; | |
} | |
add_shortcode( 'gist', 'embedGists' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment