Posting Code in Your WordPress Blog

Posting code in a WordPress blog was a pain for a long time. Everyone had a different way to format their code with CSS, and no solution was really that good. At least not compared to what I am about to show you.

The Syntax Highlighter plugin allows for code to easily be displayed in an appealing, easy to use format. All you have to do is install the plugin. Download it here:

http://wordpress.org/extend/plugins/syntaxhighlighter-plus/

After installing the plugin you will want to wrap your code in tags like this: [sourcecode language=’css’]..[/sourcecode] You can view other examples of the plugin in use on our other posts.

Now this works with many other languages besides CSS.The other supported languages are:

  • cpp
  • csharp
  • css
  • delphi
  • html
  • java
  • jscript
  • php
  • python
  • ruby
  • sql
  • vb
  • xml

For more detail on how to add use this functionality in your blog read this post:

http://faq.wordpress.com/2007/09/03/how-do-i-post-source-code/

Enjoy!

One thought on “Posting Code in Your WordPress Blog”

  1. Seems very interesting :)

    I’m currently using WP-Syntax, another plugin for syntax highlighting. This one works pretty good, but I’m missing the “copy to clipboard” functionality.

    I’ve installed the plugin, but get an PHP error in its administration panel.
    On my pages, the code is wrapped in a pre-tag with class=”brush: javascript”, but no syntax formatting is applied.

    Anyway, thanks for the heads up ;-)

    Nick

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>