Do you insert a lot of code in your posts? If you do you know it can be a tedious task at best. Here at WPCanada the majority of our material deals with tutorials and WordPress news. As such, we find ourselves writing a lot of code snippets.
The problem with writing code snippets is having your snippet look like code but not behave like code. Let's look at an example of what I mean ...
<php the_content();>
The above snippet is a WordPress function that outputs the content of your posts and pages. Now, when including that in a post I can't write it exactly as it appears because WordPress will see the < and > tags and try to execute them. If I want to post a < tag I actually have to write < and if I want to include a > tag I have to literally write > So you can see how much of a hassle this can become if you post a lot of code.
The other problem is although WordPress includes a code button on the Post Editor Toolbar it doesn't include a pre button. Of course the code button is for inserting the <code></code> tags in your posts. On the occasion you want to insert the <pre></pre> tags you have to do so manually.
I'm going to introduce you to two wonderful plugins that will solve both problems.
Decoder Button
This plugin is simply a huge time saver. Once activated it adds a Decode button to the Post Editor Toolbar. See image below.
![]()
What the plugin does it automagically convert < to < and > to > All you have to do is highlight your selected text with your mouse then hit Decode. The plugin will take care of the rest. You can see what a lifesaver it is if you have a block of code 20 lines long containing numerous < and > tags. Just highlight the entire block and press Decode. The plugin will only convert any < and/or > tags it sees and will not touch anything else.
You can download the plugin from its home at scriptygoddess.
Post Editor Buttons
Post Editor Buttons is another handy plugin to have in your toolbox if you post a lot of code. The plugin allows you to add virtually any button you want to the Post Editor Toolbar. Want to add a h3 button to your toolbar to make adding subtitles to your posts easier? Done. Want to add a pre button to your toolbar to make adding <pre></pre> tags to your posts a snap? You got it.
Once activated you can start adding your buttons by navigating to Settings > Post Editor Buttons where you will see the following screen ...

You can download the plugin from the WordPress Plugin Directory.
Editor's note: These plugins don't seem to work with the current version of WordPress. Please see the updated version of this post at Writing Code in Posts Made Easy Updated.

[...] Back in January I wrote about a couple of plugins that really simplified the task of writing code in blog posts. (See Writing Code in Posts Made Easy) [...]