Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Pull request Compare This branch is 26 commits behind dflydev:master.
Fetching latest commit...
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


=== Embed GitHub Gist ===
Contributors: dflydev
Donate link:
Tags: github, gist, source, syntax, highlight, highlighter, embed
Requires at least: 2.8.6
Tested up to: 3.0.1
Stable tag: 0.5

Embed GitHub Gists into WordPress.

== Description ==

Follow here: [Embed GitHub Gist](

Embed [GitHub]( [Gists]( into
WordPress. Provides a shortcode for posts and pages but also has the ability
to embed by hand in the event that a Gist needs to be embedded somewhere in
the page that does not pass through the shortcode filters.


`[gist id=546764]`
`[gist id=546764 file=file.txt]`
`[gist id=546764 file=file.txt bump=1]`

Cache is implemented with the Transients API to minimize delay on loading
content. Default TTL (time to live) is 86400 seconds or one day.

If `json_decode` is available, the HTML markup for the source code will be
injected into the post inline. This will ensure that the code is available to
spiders and feed readers.

If `json_decode` is not available, the standard GitHub Gist embed script
(JavaScript) is included and the raw content will be added into a `NOSCRIPT`
section wrapped as follows:

`<div class="embed-github-gist-source">`
`<pre>raw code here</pre>`
`</code >`

= Upcoming features: =

* Option for setting default TTL
* Option to bypass cache entirely
* Option to select CSS loading location preference
* Option to allow for preferring JavaScript over inline HTML
* Shortcode attribute to control inline vs. js preference
* Implement admin interface to control options

== Installation ==

1. Download the plugin zip file
1. Unzip contents of plugin zip file
1. Upload the embed-github-gist directory to the `/wp-content/plugins/` directory
1. Activate the plugin through the 'Plugins' menu in WordPress
1. Start using the plugin by adding Gists to posts!

== Frequently Asked Questions ==

= Can the cache be broken? =

Yes. Use a unique bump value to force cache to update. For instance, if you have
the following:

`[gist id=546764]`

The cache can be broken by specifying a bump value:

`[gist id=546764 bump=1]`

To break the cache again later, change to a new unique bump value:

`[gist id=546764 bump=2]`

= Can I change the TTL on a Gist-by-Gist basis? =

Yes. Specify a TTL (in seconds) like this:

`[gist id=546764 ttl=3600]`

= Can I embed a Gist outside of a post or a page? =


`<?php echo embed_github_gist(546764); ?>`

= Can I display a specific file from my gist? =

Ues. You can use the `file` parameter:

`[gist id=546764 file=file.txt]`

== Screenshots ==

No screenshots now!

== Changelog ==

= 0.6 =
 * Fixed small file-bug when using json

= 0.5 =
 * Bump release

= 0.4 =
 * Bump release ("same as 0.2")

= 0.3 =
 * Bump release ("same as 0.2")

= 0.2 =
 * Added to support passing a Gist URL as the content of the [gist] shortcode.

= 0.1 =
* First release.

== Upgrade Notice ==

= 0.4 =
No changes from previous release.

= 0.3 =
No changes from previous release.

= 0.2 =
Should have no negative impact.

= 0.1 =
First release.
Something went wrong with that request. Please try again.