If you need to post some html, css, or other kind of programming code in your WordPress blog – it all gets eaten up when your save or publish the post – especially if you use the visual editor (tinyMCE). Highlighting or escaping that code in it’s proper syntax is easy – if you have the right WordPress plugin.
I’ve downloaded and tried quite a few of these over the last year, and none really seemed to work that good for me. I don’t know if it was because I was using the visual editor most of the time or what – but they didn’t seem to escape code like they said they would. With some of these recent WordPress hack posts I’ve had a need to post code – so the issue arose again. After googling around a bit, I figured that this problem already had to be solved by someone already. So I took a look at the WordPress 2.3 Plugin Compatibility Page to see what was listed there for code syntax highlighting in WordPress and found 3 options.
I’ve seen so many broken plugins on the web – if you ever have any problems with your WP install always check the latest compatibility page to make sure that everything you’re using works with the WP version you have installed. Two out of the three options I had trouble with for one reason or another – and that left one to try which is the Code Autoescape WordPress plugin. It works like a charm for me is is very easy to use. Just escape code with the code tag, or pre and then code tag for multiple lines – and makes your code block.
let’s escape some code here:
.style {
padding: 10px;
}
goes here
that’s it – all there is to it! The only reason I type up little tips like this is usually because it was something I had a hard time finding in google myself. I’m hoping that someone in need google’s this page and finds their fix quickly! If this post helped you or if you have an additional quesiton – comment now!