There is no nice way to say it: WordPress sucks for VBA code samples.
The way it handles HTML coding isn't so hot either. WordPress was designed so people don't need to know anything about HTML. I've worked with HTML for 15 years. I understand HTML and I want near-total control over the HTML on my websites.
But I also want the ease of updating the content on my sites. I really, really wanted an easy way to find and fix broken links. To generate a list of related pages, a list of new pages, and a lot more site management features that WordPress and its plugins are really, really good at.
In a discussion over whether a friend with a small technical website, one person said the friend should definitely move to WordPress. I said "not so fast". The site is small, it has a lot of code and static content. A good template system and includes can be easy to manage if the site is small and content not added frequently.
This gives you total control over the output and you can change the theme easily (all the popular templates use a blog-style layout). Menus and side content are easy with includes – you can apply a change to all pages at once.
That's not to say WordPress can't be made to play nice. You can turn off the visual editor that is the cause of many problems… you can disable the texturizing features so WordPress doesn't reformat text.
I tried turning off the visual editor but there were times when I didn't want to hand code all the HTML or I wanted WordPress to clean up the HTML for me.
I invested in the Raw HTML Pro plugin to help eliminate some of the problems. It, along with the textarea tag, allows me to control code output pretty good and the code is easily selected and copied, ready to be pasted in the VB Editor and used.
That didn't solve all my problems though. I discovered the visual editor removed all the <a name> tags used to bookmark content on a page. (Apparently bloggers don't use them.) Now I need to either to add the tags back or remove the links pointing to the bookmarks. (I'm doing a little of both.) It doesn't like empty <p></p> tags or <br> tags either (it removes them.)
The visual editor also deleted some of my content. Fortunately it was easy to recover the content but finding the html code WordPress didn't like (that caused it to delete the content) wasn't always easy. (I hope I discovered all of the missing content immediately… )
Sample urls, such as to show how to format a URL to open a calendar in OWA, were converted into clickable links. So I wrapped them in [raw] tags (from Raw HTML Pro). Now the Broken Link plugin just tells me the links are broken.
For who-knows-what reason, all of the slashed () in file paths I had wrapped in [raw] tags were removed. It was a PITA to figure out because the was in path when I looked at it in the editor, it was just missing from the rendered page. I had Raw HTML's Disable Convert_Chars feature enabled – I disabled it on the affected pages to fix.
It's goofiness like this that makes WordPress annoying and unsuitable for some types of sites, like my friends. It's his decision though… and now he knows what to look out for if he decides to move his content into WordPress.
Thanks guys... will definitely try wpuntexturize and check out the other plugins.
I like the copy buttons on code on wordpress.com site - as long as it doesn't copy line numbers. (There are more than a few sites where the code samples are useless because copy includes line numbers.)
Noticed some stealth update plugins at the site with wpuntexturize - they might solve another annoyance. 🙂
I use wpuntexturize to stop WordPress from reformatting straight quotes into "smart" quotes, and CodeColorer for syntax highlighting. Just put your code between the code tags and everything just works. It cut and pastes beautifully and even works on code posted inside comments.
I like this for code highlighting -
http://wordpress.org/extend/plugins/syntaxhighlighter/
To get the little copy toolbar, I think you need to use v.2 in the settings.
wpuntexturize will solve a lot of code problems too. Without it, commented code can get screwed up.