GitHub Gist Shortcode

A GitHub gist is a code snippet and each gist is a Git repositories, so they are automatically versioned, forkable and usable from Git.Add the following code snippet to your theme’s functions.php file to create a shortcode that will show GitHub gists on your posts.

// GitHub Gists Shortcode // WordPress snippet by function gist_shortcode($atts) { return sprintf( '', $atts['id'], $atts['file'] ? '?file=' . $atts['file'] : '' ); } add_shortcode('gist','gist_shortcode');

The shortcode for your post is:

To display a certain file: