In this post, I’m going to show you how to display sample code into your WordPress post both with a plugin and without. This could be useful for both display code from your website, or just text that may need special formatting.
The first option that we are going to look (and what we use on WPforall) is the plugin SyntaxHighlighter Evolved, which can be found on the WordPress Directory.
What I like so much about this plugin is it’s ease of use and multiple language support, in addition to its very clean look.
- matlab (keywords only)
To use it, just use the following short code, and replace ‘enter language here’ with one of the above languages:
Alternatively, you could use gist.github.com to display your source code. Gist Github is an embeddable form (as seen above) and doesn’t require you to download any plugins. All you need to do is go to gist.github.com, paste in your code, and embed the script into your WordPress Post.