Skip to content


How to Write Code in your Blog Post

In my last post about using page numbers on the bottom of your blog, I had to view code in the blog post. Thought that was an easy job, but it turned out wasting almost 45 mintues of my time. An easy answer at google was not available either, that’s why I am putting up this blog post for anyone that wants to view code in their blog post.

Using Pre

To set your code aside so that it looks like a box of code which may be copied and pasted within other code or template file, use the <pre> HTML tag.

The <pre> tag instructs the browser to use the monospace code font, but to exactly reproduce whatever is inside of the <pre> tags. Every space, line break, every bit of code is exactly reproduced.

Use <pre> in front of the code and use </pre> at the end of the code.

You are almost done! The only thing you need to do now is replacing the < at the beginning of the code you want to view and the > at the end of the code you want to view. Replace it with:

< = &lt;
> = &gt;

This is an easy way to view code in your blog post!

For updates on Chat Business, enter your email address:

Posted in Wordpress.

Tagged with , , , , .


2 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

  1. Dan says

    Thanks, I was looking for this & it is working fine!

  2. Dino says

    Good Tips!



Some HTML is OK

or, reply to this post via trackback.