SOLAERAWEBDESIGN

NEWS AND IDEAS

CODE tags and Design365

With Solaera’s site design now (hopefully) settled for a little while, I wanted to take a second to offer some information on an HTML issue which was driving me stark raving bonkers a little while back because I could not figure it out.

WordPress is really not a big fan of letting you use HTML in your posts, but for those of us who regularly use their blogs to discuss web design, it’s useful to be able to post the language itself to be copypasted or discussed. This is, in general coding, what the <pre> or <code> tags are for — to display unformatted HTML code — and I had initially assumed that this practice could carry over to WordPress (in the HTML post panel, obviously, not the Visual one) without any particular enhancement.

However, when I posted my first block of HTML code into my post wrapped in <code> tags, I was dismayed to realize that not only did it not look the way I wanted it to, it did not appear at all. Literally. Everything I had posted within those tags had completely disappeared. Gone. Finit. I was understandably baffled; I would have (sort of) understood if the HTML had tried to render *as* HTML within the tags but it had simply vanished, leaving a little block about twenty pixels high where there should have been a full block full of code.

I still don’t know exactly why it rendered in that manner, but I have since discovered that in order to post within the <code> tags in WordPress, you cannot technically use entirely unadulterated HTML. Within those tags, all “<” marks must be written into the window as an HTML entity with an ampersand (& l t ; without the spaces). If the <code> tags contain any < marks, the contents of the tags will not render properly.

I’ve since been told that this is not just a WordPress issue, but that it has something to do with the differences between HTML and XML and the transition to a greater division between markup and styling. Be that as it may, the internet is curiously silent on this issue (at least in the searches I’ve tried to do) so hopefully this fix explanation will at least help a couple of people trying to solve a similar problem.

On a basically unrelated note, Jad Limcaco at the Design Informer recently posted a challenge to attempt to design at least one thing every day for 365 days. Whether, what with college and all, I will be able to hold up for an entire year, I’m not entirely sure, but I thought I would give it a shot, and thus I present — Solaera365.

I will hopefully be posting something there every day for the next year (hopefully of increasing quality as the year goes on); feel free to let me know what you think, or if you have any suggestions for improvement or something to design.

Leave a Reply