Oct
05

How to post source code?

There is shortcode that you can wrap around source code that preserves its formatting and even provides syntax highlighting for certain languages, like so:

Wrap your code in these tags: [sourcecode language='css']…[/sourcecode]

You can replace the language with one of the following language codes:

cpp

csharp

css

delphi

html

java

jscript

php

python

ruby

sql

vb

xml

The language attribute is required! If we don’t have what you need pick the closest.
Code in between the [sourcecode] tags will automatically be encoded for display, you don’t need to worry about HTML entities or anything.

Ryan S.

Accuwebhosting.com

Popularity: 2%

Related posts:
  1. 2010 Open Source Design Plans Hi, 2010 is the year we dive into open source...
  2. Code To Get Category Name from Post ID in WordPress? Hi, In some cases we need to find out the...
  3. Code to Limit the Character On Post Title In WordPress Blog Hi, In many cases wordpress user wants to display certain...
  4. Code To Count Post For A Year In WordPress Blog Hi, We can use below mentioned code to count and...
  5. Code To Add Gravatar For The Post Author In WordPress Blog Hi, Upto now we gravatar are displaying in the comment...

Leave a Reply

You must be logged in to post a comment.