How To Write Code in Your WordPress Posts
June 2, 2007 – 5:57 pm | by gaulardcom
|
|
This may seem a bit trivial to some of you, but might be a pain in the butt for some others.
Until recently, I never used any amount of example code in my WordPress posts. I recently installed a Wiki and began writing about some tricks and tips to help others jump the same hurdles as I have. Within these posts, it is sometimes necessary to write some example code. Well, if you have ever written code in any of your posts, you have quickly found out that WordPress doesn’t like it.
So, how do you write code in your posts? Well, WordPress says this…
There are two HTML tags which will turn text into monospaced type. They are code and tt. The latter is rarely used today, replaced by the more useful and semantically correct code, which distinguishes text that is computer code from normal language.
The code button is up on the toolbar. Just highlight the text you would like to isolate and click the code button.
I thought this was pretty helpful and have already used it for many of my posts. You can read more about writing code in your posts here.

One Response to “How To Write Code in Your WordPress Posts”
By Jim on Apr 10, 2008 | Reply
As they say, one has to get down and dirty to be able to make things work.
Just make sure to back up your files in your site before experimenting with the code writing.