WordPress SourceCode Tag And Themes

17 01 2008

1. Sourcecode tag in WordPress
2. Not for all Themes

1. Sourcecode tag in WordPress

Many of you already know that there’s this cool tag in wordpress allowing us to post code without worrying about formatting:

[ sourcecode language=’css’]…[/sourcecode]

In fact it takes care of syntax highligthing as well as preserving good indentation, like in the following example of a CSS rule:

    border:solid 1px #7E7E81;

The supported language codes are:

  • actionscript3
  • bash
  • coldfusion
  • cpp
  • csharp
  • css
  • delphi
  • erlang
  • fsharp
  • diff
  • groovy
  • javascript
  • java
  • javafx
  • matlab (keywords only)
  • objc
  • perl
  • php
  • python
  • powershell
  • r
  • ruby
  • scala
  • sql
  • vb
  • xml

You can find info at the following link:

How do I post source code?

2. Not for all Themes

What you may not know is that this feature does not work with all the themes available, for example it doesn’t work with the default wordpress theme: Kubrick.

Hope this is a useful info for people trying to make it work right now.

→ go to top




7 responses

31 08 2008

Yeah I just discovered this. Was wondering if it was picky when it came to themes. Dang, just found and tweaked a theme I really liked.

25 03 2009
To go way off topic. COBOL. « [NickJosevski(Blog = ".NET")]

[…] don’t think there’s a WordPress ’sourcecode’ tag attribute that will accept language=’COBOL’, so the highlighting won’t be perfect, even tho […]

9 05 2009
Having source code in Wordpress blog posts « Think Paus’itive

[…] some searching on google, I saw a post that said that not all WordPress.com themes support the syntax highlighting macro, the only ones […]

18 12 2009

I’m brand new to WP and I’ve tried the two default installed themes and also downloaded another one and I can’t get this shortcode to work – it always just renders as the text I pasted. I’ve pasted it in HTML view mode. Is there a place where I can see all the themes that will support this? Is it just a crap shoot?

4 01 2010
HampsteadCarpet Cleaning

Wonderful post , You definately hit the
mark with this, I just don’t think that people quite get it.
I don’t know how many individuals I’ve talked to about this very
thing in the past month, and they just can’t get it.

I similar to you am involved with Carpets and it is
quite good to see fellows associated this industry with similar mentalities and positions
, Excellent post!

17 06 2011

[…] Link to using wordpress.com sourcecode attribute This entry was posted in Uncategorized by girishthanki. Bookmark the permalink. […]

8 07 2011

Which theme supports the sourcecode tag?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: