How to Publish HTML Code in WordPress

If you’re tried to write code in WordPress for displaying to readers, you’ve probably found out it doesn’t work too well, even using the ‘blockquote’ or ‘code’ tags before and after.

There’s three ways to publish code in WordPress:

1. Copy and paste your code into DreamWeaver while in the ‘Design View’, then click to the ‘Code View’. Your code is automatically converted to the correctly escaped characters. Just remove any additional code DreamWeaver added, like <br> or <p> tags, and copy and paste back into your WordPress blog posting. (easiest)

2. Take your code and either paste it in Dreamweaver or Word. Then manually do a search replace 4 separate times for this code. (harder)
a. Search " and replace with &#34;
b. Search ‘ and replace with &#39;
c. Search / and replace with &#47;
d. Search < and replace with &lt;

Then copy and paste your replaced code back into your WordPress posting and it will display so readers can see it.

3. Take a screenshot of your code, crop, make smaller, save, upload, and link to the image URL (hardest, and has a drawback of losing SEO of the code as text in your blog).

This entry was posted in WordPress. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>