Testing Gist in WordPress

WordPress Gist Support

Apparently WordPress supports using Gists to share code.  I plan to test that with this blog post.  I created a JavaScript Gist with two simple functions.  I will try to share each file on its own.

First up is the top level Gist, not an individual file from the Gist.  I had to remove my Github name from the URL to make this work.  Annoying but hopefully I can remember to remove it.

// I edited this gist after putting it on WordPress.
alert('Hello world!');

view raw
hosted with ❤ by GitHub


view raw
hosted with ❤ by GitHub

So that works! Great! I like that because when I share source in WordPress and go back to edit the post, it changes the angle brackets to their code “>” versions!  I find that feature very frustrating, especially since I do tend to go back and make minor edits to posts.

One drawback in my testing though.  I am not able to share an individual file from within that gist.  Another note is that I was in HTML view using WordPress’ editor when I added the URL for my Gist, in the Visual view I do not see anything in that area.

Tonight I will try to edit this post using Open Live Writer to add another Gist and see how that works.

Now to see if Open Live Writer will work.

using System;
namespace Common.Interfaces
public interface ILogging : IDisposable
/// <summary>
/// This method is really for testing purposes.
/// </summary>
/// <returns>string</returns>
string GetLastMessage();
void LogError(Exception e);
void LogError(string message);
void LogInformation(string message);

view raw
hosted with ❤ by GitHub

Sadly that did not work, and it broke both gists in the post. I am simply editing it now in the WordPress editor.


Gists are a great way to go.  They do not get lost when you update/edit the post in WordPress.  If you need to edit the code you shared you can edit the Gist and it will be changed when someone view’s the post without having to edit the post.

The only gotcha is that you have to use the WordPress editor.  While this really isn’t a big deal, just an extra step.  If you use a different editor just post it as a draft to you blog, then use the WordPress editor to make sure the Gist links are not links and publish.

About SheldonS

Web developer for over 15 years mainly with Microsoft technologies from classic ASP to .NET 4. Husband, father, and aspiring amateur photographer.

Posted on March 14, 2016, in Test and tagged . Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: