WordPress.org

Forums

Content type: shouldn't it be text/xml+xhtml ? (5 posts)

  1. tjaard
    Member
    Posted 10 years ago #

    I do like WordPress, I really do. I also like the fact that xhtml is used for semantic interpretation of the pages. But I'm wondering one thing:

    Why aren't the pages served with the content type text/xml+xhtml as xhtml should be served? I may be a bit too puristic, but doing this would be a nice final touch in my opinion... (and of course IE could be excepted by browser sniffing) .

    I won't mind modifying the wordpress php files myself, but it'd be helpful if anyone knew where to put the php command for altering the content type ;) .

  2. enricopulatzo
    Member
    Posted 9 years ago #

    You're looking for header('Content-type: application/xhtml+xml'); which should go into your /wp-blog-header.php file.

    Good luck!

    (also, if you're interested in it, you can serve to IE as application/xml and then use a simple XSLT stylesheet to trick IE into serving the content as XML see my site here: http://www.josh-peters.name/software/xslt-ie/)

  3. Kafkaesqui

    Posted 9 years ago #

    A better option is to change the content type that WordPress sends automatically. To do that in WordPress, visit the following address on your WP installation:

    /wp-admin/options.php

    You'll see a long list of option settings. Scroll down to 'html_type' and edit that (as enricopulatzo noted, it should be application/xhtml+xml). The Update Settings button is all the way at the bottom.

    Just be sure you know what you're getting with this.

  4. Yngwin
    Member
    Posted 9 years ago #

    As WordPress doesn't check for validity and well-formedness of user input, you cannot rely on WP to always produce valid and well-formed XHTML. This means that the smallest mistake will make (part of) your site inaccessible -- all browsers that accept real XHTML will display an error message instead of the content. Do you really want to go that way?

    I know what I'm talking about, because I have used real XHTML myself for some time. It is not impossible, but it is impractical.

  5. enricopulatzo
    Member
    Posted 9 years ago #

    All: here's a simple plugin to set the correct MIME type if the user agent accepts application/xhtml+xml.

    I also plan on adding IE support (but that takes xslt added to the mix).

    http://software.josh-peters.name/wp-plugins/jcp_xhtmlheader.html

    Enjoy

Topic Closed

This topic has been closed to new replies.

About this Topic