Skip to content →

Add Gist oEmbed support to your WordPress theme

oEmbed is a neat way to insert embeded content form the likes of YouTube and SoundCloud. All you have to do is to place a plain text link to the resource in a paragraph of its own and the content is embeded automagically. Unfortunately, as of 4.4 none of the code snippet services (Gist, Pastebin, jsFiddle etc.) are enabled as oEmbed providers in WordPress by default.

While Pastebin does not have oEmbet support, Gist does support oEmbeds, and it is really easy to turn it on. You just have to put this piece of code by ninnypants to your theme’s *functions.php *file, or as a standalone plugin. Now, if You put a link like this:

https://gist.github.com/ninnypants/5054541

You get a result like this (the snippet is actually inserted here using Gist oEmbed):

Happy embeding!

Don’t forget to share this via , , Google+, LinkedIn and Reddit.

 

Published in Code