Displaying code in WordPress

After experiencing some problems around displaying code in WordPress (mainly around the code lines being too long and wrapping off the side of the page) I installed Dean’s Code Highlighter.

Now, don’t get me wrong, this is an excellent plugin. However, I found a flaw in it after someone reported a problem with the WordPress plugin that I launched yesterday. They’d copy and pasted the example code from my instructions page and it didn’t work. It turns out that the code highlighter had taken my single quotes and converted them to open and closed single quotes. Which broke the code.

I had a good look at the plugin code but couldn’t easily work out a solution. In the end I realised that I simply didn’t need code highlighting so turned the whole thing off. Instead, I used a similar style and applied to the bog standard CODE wrap. The only down-side is that I have to wary of the line wrapping again.

Posted by David Artiss

Enterprise Happiness Engineer for the WordPress VIP team at Automattic. Gamer, film lover and general fan of all things Marvel, Star Trek and Star Wars. Failed comedian. Writer for The Big Tech Question. World's Greatest Grandma.

Talk to me!

This site uses Akismet to reduce spam. Learn how your comment data is processed.