Last active
August 23, 2016 10:16
-
-
Save corenominal/cfd8b2315a4c0302f297 to your computer and use it in GitHub Desktop.
A simple WordPress shortcode for embedding a GitHub Gist
This file contains hidden or 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 | |
/** | |
* Github Gists | |
* Usage: [gist url="https://gist.github.com/corenominal/0efedf14eca28453a58e"] | |
*/ | |
function corenominal_shortcode_gist( $atts, $content = null) | |
{ | |
$atts = shortcode_atts( | |
array( | |
'url' => 'https://gist.github.com/corenominal/0efedf14eca28453a58e' | |
), $atts | |
); | |
return '<script src="' . $atts['url'] . '.js"></script>'; | |
} | |
add_shortcode( 'gist', 'corenominal_shortcode_gist' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment