I was looking for a solution where I easily can embed gists in WordPress without requiring an additional plugin. Fortunately, I had found an easy but outdated solution for this. The URL structure of Github only has changed for a little bit, so I have updated the regular expression and the javascript file.
How to install the embed Gists in WordPress plugin?
- Create in wp-content the directory mu-plugins.
- Create the file mrkoopie-embed-gist-in-wordpress.php with the following content:
- That is it! Check how good it looks at my blog, imagine how it is on yours… 🙂
What is wp-content/mu-plugins for?
The mu part is an abbreviation of Must Use, so the folder actually stands for Must Use Plugins. Any file is included and WordPress does not see it as an plugin, but as a required piece of code. Therefore, you will never see this file as a plugin in your dashboard. When you install the Embed Gists in WordPress solution, you are actually not installing a plugin but just a required bit of code. This also provides you some freedom, so when you want to alter the code you are free to do this without having to worry that an update overwrites your code.
Help, the Embed Gists in WordPress code does not work
It is possible that the code for embed Gists in WordPress is outdated and requires an update. Feel free to notify me when the Gist URL structure has changed, I will try to post an update. As of 15/01/2016 the structure is https://gist.github.com/MrKoopie/f157dbe63cc6ad10e3c2.
It is also possible that you have changed the folder where WordPress has to look for Must Use plugins. Check the WordPress wp-content/mu-plugins documentation for help. It is possible that you have a different setting for WPMU_PLUGIN_DIR and WPMU_PLUGIN_URL, so you may have to put the code somhewere else.
Enjoy!