Some of my posts include snippets of code that help explain the process or describe what needs to be done. Most of the code is written in Visual Studio or Dreamweaver, and as such simply copying and pasting the code into the blog post doesn’t work.
Why? well it’s because the server thinks it’s code that needs to be compiled and rendered. Using the <pre> tag, also doesn’t always work and switching between the Visual editor and the HTML editor can cause weird results. So in order to accomplish this task really easy, I’ve created Convert HTML. Convert HTML is a simple web page that allows you to convert code tags such as < and > into their character entities (< and >), which is then ignored by the server for compiling, but renders correctly on the browser.
Very simple to use, just got to this page and paste in your code including the < and >, then click on Convert. Your code should now be shown, where the special characters have been replaced by the character entities. Simply copy the new code, and paste it inside your <pre> tags.
Here’s an example using Convert HTML
<ul> <li><a href="<?php echo get_option('home'); ?>/">Home</a></li> <li> <?php wp_list_pages('title_li=&depth=1'); ?> </li> <li><a class="" href="http://blog.grapii.com/?cat=13"><span>Glossary</span></a></li> </ul>