Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am new to wordpress and I just created a new blog(free version). Now It seems that code fromat doesn't work. All lines are aligned to the left. Please look at the image below.

image

Thanks.

share|improve this question

1 Answer 1

up vote 0 down vote accepted

You need to wrap your code in either code or pre tags. code is for when inline code in a sentence e.g. include("hello.php") whereas pre is for preformatted blocks of text e.g.:

function hello_world(){
    echo 'hello world';
}

For code highlighting etc, you'll need to look for plugins.

The easiest way of using these tags is using the preformatted style:

enter image description here

share|improve this answer
    
In HTML(not Visual), I added code tag but no luck. –  Love Jul 6 '12 at 14:59
1  
That won't work, for example if I look at your screenshot I see you trying to use <code> for a block of code, which is not the correct usage at all. Reread my answer. Use <pre> –  Tom J Nowell Jul 6 '12 at 15:02
    
There is no pre tags on the menu, should I type in manually? –  Love Jul 6 '12 at 15:06
    
You can type it in manually, or in the styles dropdown, choose preformatted, see my answer for a screenshot –  Tom J Nowell Jul 6 '12 at 15:29
    
If I choice a plugin, how to? I downloaded one to my C drive, but where is the good place for it? –  Love Jul 6 '12 at 15:32

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.