Last active
August 29, 2015 14:07
-
-
Save Katamo/a903d8c6fd90178b8174 to your computer and use it in GitHub Desktop.
Shortcode para mostrar gists
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
/** | |
* Shortcode para mostrar gists | |
* Originally taken from https://kopepasah.com/tutorial/github-gist-shortcode-for-wordpress/ | |
*/ | |
function gist_shortcode( $atts ) { | |
extract( shortcode_atts( array( | |
'id' => '', | |
'file' => '', | |
), $atts ) ); | |
$gist = sprintf( | |
'<script src="https://gist.github.com/%s.js%s"></script>', | |
esc_attr( $id ), | |
$file ? '?file=' . esc_attr( $file ) : '' | |
); | |
return $gist; | |
} | |
add_shortcode( 'gist', 'gist_shortcode' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment