What theme is good for posting code? [closed]

I would suggest that you flip the question to What plugin is good for posting code?. You can only do so much with <pre> and <code> HTML tags. I post code snippets on my blog all the time using the WP-Syntax plugin. Here’s a nice working example:

A WordPress Blog Post with PHP, TXT and HTML snippets using the WP-Syntax Plugin

It allows me to identify the code I post as CSS, HTML, JavaScript, PHP, plain text, and many more. Then it color codes the snippets accordingly.

It also preserves indents which I’ve found very useful for usability/user experience when copy/pasting decent sized code snippets from other sites.

The syntax is easy, you just switch to the HTML editor in a post and wrap all of your code in a <pre> tag. For example:

<pre lang="php">
  <?php
    echo "I love cheese!";
  ?>
</pre>

The above will output a nice color coded PHP snippet. The plugin leverages the GeSHi syntax highlighting class to do its dirty work. All of the available languages are outlined on the GeSHi website.

Leave a Comment