How To Add Source Code in WordPress Posts

There is a tutorial on WordPress which explains how to post source code in wordpress posts which is hard to find via Google search.

All you need to do is to surround source code in

&#91sourcecode&#93 insert source code here &#91&#92 sourcecode&#93

WordPress will automatically recognize this and will parse accordingly.

You can specify language e.g. php, css, javascript etc as followings:

&#91sourcecode language=”css” &#93 insert source code here&#91&#92 sourcecode&#93

Here is how it looks

The following is a simple link
MLB

Following is a the source code for above link which is displayed using sourcecode formatting.

[sourcecode]<a title="MLB" href="http://www.mlb4all.com" target="_blank">MLB</a>[/sourcecode]


Comments

One response to “How To Add Source Code in WordPress Posts”

  1. u can use a simple online app, TOHTML

    here u can enter the source code , select the language and style and get html code ,that u can paste in the editor to get a formatted code, i have used it and it also highlights different syntax.

Leave a Reply

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