How to embed gist on wordpress blog without using any plugin

If you are writing a tutorial blog post related to programming codes with the sole purpose of sharing the knowledge you might be dependent on any code sharing plugin. Sometimes plugin doesn’t work properly either because of theme or some other reasons and you mess up with fixing code again and again. Nowadays you might be noticing blogger is using GIST for sharing code and at the same time, you may want to do the same but not able to figure out how to embed gist on WordPress blog post. In this blog, I am going to teach you how you can embed gist in your WordPress blog posts.

Simply Use given code in the functions.php file and after that update your functions.php file.
https://gist.github.com/aa0c1dc8d2b334db0d07361c94ea0d8e

And when you’re done all you have to do is add a link to a post like given below :

https://gist.github.com/aa0c1dc8d2b334db0d07361c94ea0d8e

The Gist will be embedded in your post. Gist automatically adds your username to the Gist URL, and if you leave(don’t remove) that username in the URL in your post then it won’t embed the Gist on your post– it will simply display the URL on your post.

But removing username from your one or two Gist URL seems ok but what If you are writing a long article and have to embed many Gist URL. It would be a hectic task. Don’t worry!

Simply use given code in the functions.php file and after that update your functions.php file
https://gist.github.com/raviranjankr/b819d3edd1cfaad2c7fa181fe45814dd

And when you’re done all you have to do is add a link to a post :

https://gist.github.com/raviranjankr/b819d3edd1cfaad2c7fa181fe45814dd

Github gists are a great platform to write code and share on your WordPress blog posts quickly.

Happy Coding 🙂

Leave a Reply