I received some feedback on one of our Carrington themes recently, letting me know that while we were declaring the DOCTYPE of the theme as XHTML 1.0 Transitional, it would be simple to go to XHTML 1.1 Strict based on the markup in the theme.
This didn’t surprise me, we always code to pretty strict web standard best practices at Crowd Favorite so XHTML 1.1 compatibility is generally just a matter of a tweak here or there. However, just because it’s an easy change doesn’t mean it’s a good change.
The main reason we choose to use XHTML 1.0 Transitional for our WordPress themes is simple: we have no idea what someone might decide to do with it. 🙂
It doesn’t matter if the theme validates strictly if the content doesn’t – and with all of the great tools and widgets available for WordPress, it’s pretty easy to add something that breaks your strict validation.
This is something you should consider if you’re a theme developer. Don’t just think about the code you’ve written to build the theme, think about what people using your theme will be doing with it; and make the best choice you can.
In your case when designing for the masses I say you kind of have to stick with transitional. The end-user, if they know better to ask about the doctype they know enough to change it themselves.
In my case where the client wouldn’t ever know the difference and I’m the only one touching them code… I go strict.
But with html5 someday around the corner… I may change that too… no rush yet however 🙂
What about the plugins? I mean that the user of the theme may install a thing-a-majig -plugin that is does not validate.
Again this is not an issue if you as the theme developer are the only one touching the code or doing the admin stuff for the blog.
Please tell me you meant XHTML 1.0 Strict, since there’s no such thing as XHTML 1.1 Strict (it’s just XHTML 1.1, and MUST be served as an XML application to be parsed correctly).
Sorry, just a markup pet peeve of mine.
the Doc Is a Type a Stranger
I Think he love to have Jack Daniels
The Doc comes from the Good ole south Yer knoW
Yes, XHTML 1.1 is the choice
I’ve never seen this option in a theme — until Angelus (not-yet-released) — but why not add an option to allow users of the theme to choose DOCTYPE for themselves? Yeah, it requires a little extra logic in the theme to account for possible markup changes (such as differing Content-Types), but by and large, it should be a simple choice.
And it would allow markup geeks to choose XHTML 1.1 while the average user could use XHTML 1 Transitional, which should be the default choice.
Giving users this choice is just another way we theme coders can better serve the varying users which we might come across “in the wild.”
But I can’t overstate that the themes should default to 1.0 Transitional; the vast majority of users aren’t going to take the time to learn valid XHTML, will paste in widget embed codes without cleaning them up (a lot of invalid code out there…), and so on.
I agree with Chuck and Alex – stick with transitional and let people who want strict – and know that the changes they make won’t break that – change it for themselves. I honestly don’t see the point of adding it as an option, because most people neither know nor care (and adding in lots of options just because you can isn’t great usability for the vast majority).
Great points especially considering that many plugins add their own CSS and unfortunately PHP coders not always best CSS coders and validations go out the door.
Exactly because of 3rd party plugins as well as content sucked in from other places (comments, feeds, etc) I’ve never thought XHTML was a good idea for WordPress (or for that matter similar projects like Drupal, etc.) Chalk me up in the “sending XML as text/html is a bad idea” camp. In the past I’ve battled making WordPress output valid HTML 4.01 but thankfully HTML 5, as currently drafted, would resolve most of the issues I run into.
I think one thing to keep in mind is that, from a HTML user agent point-of-view, a doctype really only serves one purpose: rendering mode switching. If your content and templates are part of an XML pipeline or you rely heavily on validation services, then the exact doctype string becomes more important. I think Henri Sivonen has done some of the best write-ups on things like doctypes, quirks mode, and HTML’s history with respect to SGML:
(For whatever reason, Henri’s use of @font-face causes some his pages to render rather slowly for me in either Safari 4 or Firefox 3.5… just a heads up.)
Alex you just made a lifelong fan of me!
I’m actually rather obsessive about coding to as strict a standard as possible. But I’m always on the side of users when push comes to shove!
The best of both worlds helps the user build conforming content.
All the other comments are excellent… an excellent start to my day.
XHTML 1.1 drops the use of # (anchoring) and WordPress uses this feature (click on comments link). I find that annoying and recently stepped back to 1.0 because removing that function is counter productive to the end user in my opinion. (I read a lot online and do research, love the #anchor)
XHTML loses the “target” value that includes the much debated (open in a) “_blank” (page) tag. Opening in a new page is a heated concept and I will defend it. My defense comes from the only counter-defense being “_blank” in MSIE 6 (aka “el diablo”) can ‘confuse users’ in full screen mode. Bleh…
Anyone using MSIE 6 probably has not updated their box since Bush was voted into office and I have had far too many MSIE browsers complain that the site is broken (and XHTML 1.X will break in this browser).
Despite my ongoing and outright BANNING of MSIE 6 from my sites, my client base demands this browser be included. In certain markets my stats and analytics show MSIE 6 at 20-30% of the browser share. Last overall stat I saw was about 10-15% MSIE 6 (more than Apple’s share of the web I remind you).
Transitional IS the way to go for a few more years. My personal JS library has simple script for opening in a new window (because even WordPress core works uses “_blank”). My work validates XHTML 1.0, this is habit now, a total breeze to code for, I write complicated applications and I am also a CSS ninja with UI skills. But the reality of the web says “Transitional”.
When you look through the guiding principles of strict (separation of actions) and CSS layout is is easy to see that there are fundamental flaws, and I can accept these facts. I create applications for the business world (having worked exclusively in Real Estate web for several years) and I can tell you that the majority of people who fanatically advocate Strict are usually coding for themselves and their buddies. Web masturbation to put it into a crude term.
With HTML 5 around the corner (and CSS3 here more or less) you will, again, be coding for yourself. I am SO excited to have native audio and video support in HTML 5, canvass looks kick ass too! But to push this on a business who is running XP SP1 on 7000 boxes is a waste of time.
My point – know your customer. If you can -legitimately- sell them on Strict that is awesome, go for it. Otherwise put your web Vaseline back in the closet and do what is best for the web and your client without selling our soul.
Oh, and then there is dual validation. That is how I sneak Strict into my sites.
[…] Which DOCTYPE to use for WordPress Themes? […]
XHTML1.1 is about as useful as XHTML2. It has to be served as application/xhtml+xml which none of the IE family accept and will easily result in a meaningless (to the end user) error message with even the slightest XML validation error.
As far as I’m concern there’s only one flavour of XHTML1.0 that you should ever use and that’s Strict. Transitional is just lazy. Don’t let your clients write HTML if they don’t know how and if you’re using a WYSIWYG editor (eg: TinyMCE, FCKeditor, etc) then make sure that you use one that will produce valid markup. I’ve found it quite possible to get TinyMCE to produce only valid markup.
The DOCTYPE that I suggest you use is that of HTML5. When used in a backwards compatible fashion (with none of the new HTML elements) it is very versatile. HTML5 isn’t “around the corner”, it’s already here.
I sign on that.
I use a widget that prints some lis but doesn’t print the uls. It builds a div and goes directly to li, it’s a shame 😛
I recently discovered that some widgets I added do not validate for Xhtml strict. I’m not a php coder. I know HTML and am getting better at CSS. I see my options as being to remove/replace the widgets or change the doc type, but changing the doc type sounds complicated. How much coding could I expect to do if I changed from strict to transitional?