Last modified:

There are a lot of examples on the Web explaining how to use <pre><code> blocks to display programming code in a post. And there are a lot of plugins that claim they will allow you to display your code easily but I had never found one that actually worked well.

I was frustrated with finding a simple solution to this problem. Up until today, that is. Here is a plugin that works for what I want it to do.

A Plugin to Post Code Snippets That Actually Works


The Code Snippet Library plugin uses it’s admin section to store your snippets of code. You then display the snippet in your post by using a shortcode. When you save the snippet, the plugin generates an id number for it. You use the id with the shortcode to display the code.

For example, I saved a PHP bubble sort and the id number was 70. To display the code you only need to put [snippet id="70"] in your post. This is the result:

[snippet id=”70″]

In some ways it is a little bit of a hassle to save the code in the plugin’s admin section. But it is easy to learn to live with this because the displayed code in the post just works. And ‘just works’ is very good.

At this point I highly recommend this plugin if you want what seems to be foolproof way of putting code snippets in your posts. The plugin also has choices for a number of themes, both light and dark. You can find more information and download the plugin here: Code Snippet Library plugin at

Leave a Comment