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.


Disclosure: In full disclosure, it is safe to assume that the site owner is benefiting financially or otherwise from everything you click on, read, or look at while on my website. This is not to say that is the case with all content, as all publications on the site are original and written to provide value and references to our audience.


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