Last active
December 12, 2015 03:09
-
-
Save kopepasah/4705122 to your computer and use it in GitHub Desktop.
This gist shortcode with get the file content of each gist and output the contents for you site.
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 | |
function gist_shortcode( $atts ) { | |
extract( shortcode_atts( array( | |
'user' => '', | |
'id' => '', | |
'file' => '', | |
), $atts ) ); | |
if ( empty( $user ) | empty( $id ) | empty( $file ) ) | |
return; | |
$output = file_get_contents( 'https://gist.github.com/' . $user . '/' . $id . '/raw/' . $file ); | |
return $output; | |
} | |
add_shortcode( 'gist', 'gist_shortcode' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment