WordPress sourcecode tag

If you manage your website/weblog with WordPress and frequently use code in your posts, you can easily show your code in especial format nicely with using Syntax Highlighter plugin. This plugin provides its own built in tags which you can utilize them in your posts. In order, to represent code in WordPress using Syntax Highlighter you can use “sourcecode” tag.

Keep in mind that the style of this tag is different from HTML tag. Code/Sourcecode tag is surrounded by “[” and “]” character. Following example shows how to use it.

[‘sourcecode’]

Your source code should be placed here.

[‘/sourcecode’]

Note: code tag and sourcecode tag are similar to each other and you can use one instead of the another.

Both sourcecode and code tags support following syntax.

1-actionscript3

2-bash

3-clojure

4-coldfusion

5-cpp

6-csharp

7-css

8-delphi

9-erlang

10-fsharp

11-diff

12-groovy

13-html

14-javascript

15-java

16-javafx

17-matlab (keywords only)

18-objc

19-perl

20-php

21-text

22-powershell

23-python

24-r

25-ruby

26-scala

27-sql

28-vb

29-xml

If you do not set language, it is set to “text” by default.

Sourcecode tag has many options which you can set such as highlight, first line, etc.

More information can be found in official web page of WordPress.

Leave a Reply

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