Support » Fixing WordPress » Why won’t this validate?

  • I’m working on a template (it’s not plugged in to WP yet), and I’m geting this error that I don’t understand when I go to validate:

    This page validates as valid XHTML, but when I try to validate the CSS, I get the following error:

    Target: http://www.vertigo25.com/vf/test2b.html

    Please, validate your XML document first!

    Line 1

    Column 1

    Content is not allowed in prolog.

    This makes me think that there’s something wrong with my doctype, or something, but I can’t figure it out…

Viewing 4 replies - 1 through 4 (of 4 total)
  • You are missing a whole chunk of information that needs to be in your header.php.

    The best solution is to open the header.php in your theme and in the Default WordPress Theme and compare the two. Copy over the top information from the Default Theme into your Theme header and then try this again.

    I bet that will fix it.

    Specifically you are missing:

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head profile="http://gmpg.org/xfn/11">
    <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />

    But compare the two and add the missing elements.

    Oh, and why not move the big lump of CSS to the style sheet so everything is in one place. Keeps things nice and clean that way, though some people don’t do it. The site is simple enough to have it all in the style sheet.

    Thread Starter scruffy

    (@scruffy)

    Right now, it’s just an HTML page. I haven’t hacked it apart for WP yet, so putting PHP snippets in it will only break it further.

    I actually removed the xfn profile info thinking that it may be the cause of the problem. The XFN data isn’t at all necessary, anyway, unless you’re going to be using XFN (I never do, and in this case there will be even less of a chance of it happening). Other than that, the html type and and charset are just going to be what they are here when WP outputs it anyway. You’ll notice that that info on my blog at ipodnirvana.com is exactly the same as it is here.

    Thread Starter scruffy

    (@scruffy)

    And… the CSS will be moved to an external style sheet.

    This is just the way I develop my templates. It makes it easier to have all of the info on one page while I make it.

    Thread Starter scruffy

    (@scruffy)

    I figured it out.

    I wasn’t saving the file out properly in TextWrangler. I was saving it as Unicode UTF-8, but what I wanted was Unicode UTF-8 (No BOM).

    I have no idea what a BOM is, but apparently the W3C doesn’t like it.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Why won’t this validate?’ is closed to new replies.