When someone copies code with those slanted quote marks and apostrophes and pastes it into their template file, the code won’t work. The quote marks and apostrophes must be converted into text quote marks and apostrophes, not those pretty smart quotes.
To make the code look pretty, I converted the quote marks and other characters to HTML character entities and the results are:
<a href="http://lorelle.wordpress.com/" title="Lorelle's article on WordPress">Lorelle's article on WordPress</a>
Now, the quote marks and apostrophes are straightened up in text form, ready for copying.
With the quote marks, apostrophes, and slash marks turned into character entities and the code wrapped in a <code> tag, the underlying code looks like:
<a href="http://lorelle.wordpress.com/" title="Lorelle's article on WordPress">Lorelle's article on WordPress</a>
This is hard to read but necessary to display the code for your readers to use. The < character code replaces the < and takes the power of the code command away so the code is just text.
You may also notice that the greater than arrow (>) isn’t converted. Some versions of WordPress will automatically convert this arrow into it’s character entity code (>) or may leave it. Since there is no opening arrow to indicate this is “code”, the use of that arrow is unimportant and ignored.
To display a bit of WordPress code from a WordPress Theme which initiates the Customizable Post Listings WordPress Plugin, if it exists, it would be written like this:
<?php if (function_exists('c2c_get_recent_posts')) {
echo ('<li id="recent">Recent Articles<ul>');
c2c_get_recent_posts(10);
echo ('</ul></li>');
} ?>
When published on your WordPress blog, it would look like the proper code:
<?php if (function_exists('c2c_get_recent_posts')) {
echo ('<li id="recent">Recent Articles<ul>');
c2c_get_recent_posts(10);
echo ('</ul></li>');
} ?>
The character entities convert to their proper “look” as text and code on the page. The reader can copy and paste that directly into their own code files and it should work, if the code works.
To make code work as a printable and copyable code, the most popular character codes that need converting are:
- < -
< - ” -
" - ‘ -
' - / -
/
I have a longer list of conversion examples in Signatures and Writing Code.
There are many ways to convert your code into publishing content. You can do the conversion manually using a text editor with a good search and replace function. Use an online code converter or paid, shareware, or freeware code converter program. Or if you use code regularly in your WordPress blog, get a WordPress Plugin that make the job much easier from within your Write Post panel.
To use an online or downloadable program to convert code to something publishable on your blog, consider the following:
- HTML Code Converter
- Tamba2’s Simple Code Converter
- HTMLizer Data
- FoxInternet - Keyboard HTML Character Entities Converter
- Forret HTML Character Entities Converter
- Character Entities List and Map
- ASCII HTML Codes
- HTML Character Codes
- Easy Tools - Easy Text to HTML Free Program
At all times when working with code, use a text editor not a word processor so the quote marks, apostrophes, and other code will not be automatically converted into characters which will not copy and paste well into your code files.
Publishing the Code That Writes the Code
As you’ve seen, I’ve taken the step of publishing the code that will generate the code readers will see on their browser screens. This is much harder than you may think.
Since character entity codes within the code are necessary for the code to display in its pieces, I have to convert each character entity code into something that convert and display properly.
I explain this is greater detail in my article on publishing signatures and writing code in your WordPress posts, but here is an example.
In order to display a quote mark as a text quote, and then display it as I write it, and then display it as the code it took to write it, this is the evolution of the character code:
" - " - &#34;
As I have to break down each part of the character code in order for those parts to display, replacing each character code element with its printable equivalent, the underlying code gets longer and longer, and much more complicated to read. And very hard work.
For more information on writing and publishing code on your blog, se

