When I write blogs which explains something using code snippet, i used to add the code directly and blockquote it later i find some plugins which will render the code in the readable format with syntax highlighting, later i used to add code snippet in GIST and embed in post using some plugins, recently i got a chance to read this post
Which lets you to embed the GIST code in your blog post without any additional plugins with simple steps
- Login to WP_admin
- In WordPress admin console
- Goto Appearance > Editor > Select the current theme and click on functions.php
- Paste the below code snippet to your WordPress theme function.php file
and simply add your gist url without the username
Say, if this is my URL https://gist.github.com/asvignesh/61b7f687f249a61e3117
add to post as https://gist.github.com/61b7f687f249a61e3117 which will automatically embed as code snippet
if you want to embed particular file, use file query string https://gist.github.com/56654ec2130b5271f97a?file=MyClass.java
Software developer experience in building storage management and Data protection software for the Private and public cloud.
This is a personal weblog. The opinions expressed here represent my own and not those of my employer. my thoughts and opinions change from time to time… This weblog is intended to provide a semi-permanent point in time snapshot and manifestation of the various memes running around my brain, and as such any thoughts and opinions expressed within out-of-date posts may not the same, nor even similar, to those I may hold today.