Make WordPress Core

Opened 12 years ago

Closed 10 years ago

Last modified 10 years ago

#2141 closed enhancement (wontfix)

Serve XHTML properly

Reported by: rolandog Owned by: jacobsantos
Milestone: Priority: low
Severity: minor Version: 2.5
Component: Template Keywords: xhtml serve properly serving application text html strict template
Focuses: Cc:


I searched but didn't find much related to serving xhtml as application/xhtml+xml and having it work in IE. I found this article a few days ago (while wondering how to serve xhtml properly, so that IE6 doesn't attempt to download the document).

My question is "why hasn't this been featured properly in the default template?"

Since Wordpress is all about compliance, I guess we owe it to WP to make our documents REALLY valid. The article explains how to serve a document in XHTML with the proper mimetype of application/xhtml+xml (if the browser supports it) or in plain ol' HTML strict as text/html.

If anyone wants to add this functionality, you just have to save the script into a file called 'mimetype.php', then include it in your template instead of the html element tag. Like this:

<?php include (TEMPLATEPATH . "/mimetype.php"); ?>

I'm currently using the 'fix'... and so is the guy from the article, so I feel if there is a workaround for the IE issue, lets use it.

Change History (7)

#1 @masquerade
12 years ago

XHTML 1.0 does not have to be sent with as text/html and still be perfectly valid, which WordPress currently does. Until the default templates are XHTML 1.1 or a majority of the browsing market can accept XML mime-types, there really is no reason to incorperate them, and it will undoubtably cause trouble for the people trying to make their own custom templates, as XML parsing is /very/ strict where XHTML is not. One typo and the page won't even display. If anyone wants to add this to their won templates, they can feel free.

-1 for this, wait for IE to do it right, instead of working around it

#2 @matt
12 years ago

  • Resolution set to wontfix
  • Status changed from new to closed

#3 @(none)
11 years ago

  • Milestone 2.0 deleted

Milestone 2.0 deleted

#4 @vlogtheimpaler
10 years ago

  • Keywords template added
  • Milestone set to 2.7
  • Priority changed from normal to low
  • Resolution wontfix deleted
  • Severity changed from normal to minor
  • Status changed from closed to reopened
  • Version changed from 2.0 to 2.5

I'd like to reopen this with a proposal for solution or some kind of middle ground for those who may actually want to serve up true xhtml 1.1 documents properly within WP. Why not simply have a switch somewhere within the options panel for sending valid headers based on the above script? As useful as it is, the above "fix" is limited at best within WP 2.5. And between views (single entries vs pages) it throws php errors as WP appears to write its own in some instances. A fall back or possibly even the initial primary option would be to including it as rewrite rules to achieve a similar effect.

Either way, if the user doesn't know what the option does or doesn't want to use it then they don't have to. It shouldn't affect them unless they're attempting to view tag soup with the wrong headers in which case simple documentation could help them before, during or after selecting such an option. Either way if they do explore it, it might actually help promote true xhtml support and enable other users to actually create well formatted code. Any power user versed in xhtml who has or wants to use proper xhtml templates could do so just as easily with this.

To rationalize it a little further - it's pointless, and maybe apathetic to wait around because one browser can't get it right. Granted it's a major browser, but that doesn't mean others should be held back for it's short-comings while other browsers can easily do the same job or even more. Making up excuses for themes not supporting it is a very weak at best as well, with a few minor tweaks many templates can easily be served with the CORRECT headers and others might need a little more work. On that end of the spectrum it's neither impossible or mandatory, and as mentioned before it may even educate many people in the process.

In the end, it would shift the burden of proper xhtml support onto the browser makers and not because the excuse exists for not enough sites serving proper xhtml documents. I don't want to push this as a mandatory action to take a stand or anything, but just a power user expecting a little more out of a great application with it's own little short-comings.

#5 @santosj
10 years ago

  • Owner changed from anonymous to jacobsantos
  • Status changed from reopened to new

It is possible to create a function in functions.php that will turn this on for themes that want it. Or at least build a plugin that will allow it. Seems Interesting, so I'll take it.

#6 @santosj
10 years ago

  • Milestone 2.7 deleted
  • Resolution set to wontfix
  • Status changed from new to closed

This can be done in a plugin and in the theme.

#7 @vlogtheimpaler
10 years ago

santos, could you share the location of such a plugin? All the plugins I have tested throw errors of some type or are simply incompatible.

Note: See TracTickets for help on using tickets.