I attempted to update the current XHTML 1.0 Transisional WordPress theme in order to comply with the XHTML 1.1 Specification. I must admit that the switch was not that difficult and it required no more than 30 minutes to complete. All the errors and inconsistencies the W3C validator threw at me have been corrected and all seem to be fine by now. Below, I have posted some information about some of the changes, which may prove helpful to the reader, whenever s/he attempts such a switch of standards.
So, start by changing the document type in the
header.php file of your theme. Replace the current one with the following:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
Then visit the W3C Markup Validation Service and start validating your webpages. Alternatively, you may want to add a hyperlink somewhere in your theme’s footer, which will point to a specific page on the validator’s web site, which will automatically examine the referer of the request; that is your page that needs validation. Add the following hyperlink:
<a href="http://validator.w3.org/check/referer">Validate XHTML</a>
If your current theme is well-made you won’t be needing major modifications.
Below there is some info about the changes that required significantly more time than others, because of the many occurencies throughout the theme and the plugins’ code.
1 – The
<script> element does not have a
language attribute any more, so:
… should become just:
2 – Named anchors, like:
3 – The
border attribute should be removed from the
4 – Finally, the
target attribute that was frequently used inside
<a> elements in order to specify the target frame is not included in the XHTML 1.1 specification. Fortunately, there is a decent workaround for this.
Instead of the:
<a [...] target="_blank" [...] </a>
<a [...] onclick="window.open(this.href); return false;" onkeypress="window.open(this.href); return false;" [...] </a>
Apart from this, there is another way to pass the XHTML 1.1 validation test, even if you use the
target attribute. This is because XHTML has been modularized. By default only 4 core modules are included, but one can create a very own document type definition (DTD), which may inlude the
target or any other module. The new DTD can then be uploaded somewhere on the net, so that people can link to it from within their pages
DOCTYPE declaration. More information about this and an example can be found here.
The Moving on to XHTML 1.1 by George Notaras, unless otherwise expressly stated, is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.