I'm wondering what you guys think about redoing WordPress so that it uses the Strict doctype. At the moment WordPress is using XHTML Transitional. How difficult do you think it would be?
| SitePoint Sponsor |



I'm wondering what you guys think about redoing WordPress so that it uses the Strict doctype. At the moment WordPress is using XHTML Transitional. How difficult do you think it would be?



If your theme is written using transitional then changing it to strict might easily muck something up. If you are doing your own theme it's perfectly easy to use strict. I've done it with no problem.
Wordpress itself does not require any particular doctype, only the default themes that come with the installation use it, but you can find themes that use strict.
Ed Seedhouse



That's good, as I'm of the opinion that a Strict doctype is more appropriate (for new websites - for example if I were to code a website, it would be with a Strict doctype). I'll be attempting my first WordPress theme soon.


Have you found a way for WordPress to serve pages with the correct content type instead of "Content-Type: text/html" ??
I suppose "fake" XHTML Strict is better than "fake" XHTML Transitional. But if you know of a way to have it doctype-switch I'm interested.



Correct me if I'm wrong but isn't the problem the same if you serve it as transitional or strict? It would be nice if someone would rewrite the backend to put out proper html 4 type syntax, though, instead of faking xhtml.
If someone hacks the html on the back end to put out the right header, that would mean that IE just couldn't display it sensibly at all, right?
Ed Seedhouse


You are correct. Without some form of "doctype switching", IE doesn't handle it.
For the "my pages" part of my site I've been using
There are other variations of this, but AFAIK, this is OK, although apparently some bots don't send HTTP ACCEPT headers.PHP Code:header("Vary: Accept");
if (stristr($_SERVER["HTTP_ACCEPT"], "application/xhtml+xml"))
{
header("Content-Type: application/xhtml+xml; charset=utf-8");
}
else
{
header("Content-Type: text/html; charset=utf-8");
}
But I have not figured out a way to do something similar for the "blog" or "forum" parts of my site yet.



Have any of you tried writing your themes using the HTML Strict doctype? I read something over at WordPress.org that suggests that it might not work that well. http://wordpress.org/extend/ideas/topic.php?id=1391
Bookmarks