SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Evangelist happyoink's Avatar
    Join Date
    Jan 2008
    Location
    UK
    Posts
    503
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Converting WordPress to use XHTML Strict

    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?

  2. #2
    SitePoint Evangelist Ed Seedhouse's Avatar
    Join Date
    Aug 2006
    Location
    Victoria, B.C. Canada
    Posts
    592
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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

  3. #3
    SitePoint Evangelist happyoink's Avatar
    Join Date
    Jan 2008
    Location
    UK
    Posts
    503
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

  4. #4
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,271
    Mentioned
    197 Post(s)
    Tagged
    3 Thread(s)
    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.

  5. #5
    SitePoint Evangelist Ed Seedhouse's Avatar
    Join Date
    Aug 2006
    Location
    Victoria, B.C. Canada
    Posts
    592
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Mittineague View Post
    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

  6. #6
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,271
    Mentioned
    197 Post(s)
    Tagged
    3 Thread(s)
    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
    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");

    There are other variations of this, but AFAIK, this is OK, although apparently some bots don't send HTTP ACCEPT headers.
    But I have not figured out a way to do something similar for the "blog" or "forum" parts of my site yet.

  7. #7
    SitePoint Evangelist happyoink's Avatar
    Join Date
    Jan 2008
    Location
    UK
    Posts
    503
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •