One of the largest shortcomings of the WYSIWYG editor bundled with WordPress is that like may so called “smart” editors, it likes to change your code for you. Visual editors are notorious for this, and have been for years. It seems that the designers of these editors just “know” that what you were trying to do can be done in a different way, and of course, since their way is better, they code it into their editor.
In the case of the TinyMCE editor bundled with WordPress, the designers were pretty sure that you wouldn’t ever want to use a < div > (or layer) tag. In fact, they felt so strongly about it that they coded the default editor behavior to change any entered into a < p >, or paragraph tag. While this might not be an issue in most simple editing cases, it can be a major headache if what you are trying to do requires the use of any of the tags that the visual editor automatically alters.
This problem is seen time and again on the WordPress Codex help forums. For the more hard core in the WordPress camps, the mantra is simply “never, ever use the visual editor”. For them, entering code into the textbox in its raw state is good enough. While this method works, it is not one I’m fond of. Perhaps if it were still 1997 I would agree, but tools like dreamweaver have spoiled me and I don’t really want to go back to editing my code in plain text. (something I will admit to being a complete nerd about when I started in the industry.)
I ran into this problem the other day on another one of my blogs. The only way to align an image in the theme I’m using there is to wrap that image in a < div > tag with a class of captionright, captionleft or captioncenter. Using the editors built in align function simply doesn’t do anything in a heavy CSS design. The stylesheet rules cancel out the code used by the editor for aligning images. (Which isn’t very good code to start with.)
Enter Trustworthy XHTML, a plugin from Leo Jackson. it’s a bit of a challenge to get configured, as you have to set both global options and then options for yourself as a user, but once that’s done, et viola! Enter code to your heart’s content and WordPress graciously leaves it as you entered it in the code editor. While I’ve only juststarted using Leo’s plugin, I can tell you that I already know I don’t want to live without it.
Trustworthy XHTML gives five options for how WordPress will deal with the code you entered, from the Default, which leaves WordPress alone to do its thing, to Anything goes, a textbox that will allow you to enter absolutely anything. (I don’t recommend the last option unless you really, really know what you’re about.)
There are other plugins out there, and I’ll be getting to those over the course of the next week or so, but for now Leo has a new fan in me, and his plugin is running happily on my food and cooking blog, keeping my images where I want them.
Popularity: 1% [?]
0 Responses
Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.