How to display Raw Code in your WordPress Posts?

0

WordPress is a really great piece of software but sometimes it fails miserably and you just wonder if none else has had this problem before.

One of these stories is when it comes to display raw code in a WordPress post.

WordPress tries to interpret and execute everything it considers code in a post and makes it hard to display raw code in an uninterpreted form.

So when you are writing a tutorial that includes HTML or PHP code, copy and paste is not a solution. Neither is to put <code></code> around it.

This helps with CSS styling but actually not with the issue of displaying raw code properly.

The solution to this problem is to copy the code and paste it to a web service that can encode the HTML and PHP tags like Postable or HTML Encoder.

The encoded code can then be copied and pasted into your WordPress post and voila: It looks exactly as expected once it is posted.

Sharing is caring...
Tweet about this on TwitterShare on Google+Pin on PinterestShare on FacebookShare on TumblrDigg thisShare on LinkedInShare on RedditBuffer this pageFlattr the authorShare on StumbleUponPrint this pageEmail this to someone