Plugin: Syntax Highlight.

If you’ve ever tried to include a snippet of code in your post you might have run into a common problem where WordPress decides to work it’s magic and format your code into something pretty unusable for demonstration purposes. You might have tried to code tag, but that doesn’t help much either.

One solution is to run your post through a tool to convert the code into something WordPress won’t modify. This is what I used in my last post. But a better solution is a plugin called Syntax Highlighter that saves you the extra steps and formats everything much more nicely.

All you do is wrap your code in [ sourcecode language=’ Appropriate language here ‘] and voila. So the following,

[ sourcecode language='php']

<?php if ( is_category(5) ) { ?>

<a href="/News/"><div class="menu_active">News</div></a>

<?php wp_list_categories('orderby=id&show_count=1&use_desc_for_title=0&child_of=5&title_li='); ?>

<a href="/opinion/"><div class="menu_inactive">Opinion</div></a>
<a href="/archives/"><div class="menu_inactive">Archive</div></a>

Will displays like this.

[sourcecode language=’php’]< ?php if ( is_category(5) ) { ?>

< ?php wp_list_categories(’orderby=id&show_count=1&use_desc_for_title=0&child_of=5&title_li=’); ?>


Now isn’t this much nicer? Kevin just installed this plugin here at Blogging Tips and hopefully it will make it easier and prettier for posts with code from here on.


  1. Sarah April 26, 2008
  2. superjason April 26, 2008