How to Add Code Snippets into a WordPress Post
Writing Code in Your WordPress Posts
An easy way to add code snippets without code getting translated by the browser, and if you need this functionality only ones in a while, is to use this online tool Postable. This tool translates code with the use of character entities or extended characters to represent for example the left and right arrow characters „<>“ in a way that is not recognized as the beginning and end of an HTML tag by a web browser:
< = < or <
> = > or >
/ = /
Postable does all this text transformation for you, so you can post a code snipped into a post and preserve it as a code snipped.
Post the „friendly“ text into your blog post and in HTML view make sure the pre tag is enclosing the whole block of code: <pre>text</pre>Style the pre tag in your style sheet.