Support » Fixing WordPress » Tracking Down an HTML Error

  • Sigh. I’m such a novice.

    I cut and pasted from an old template into my WordPress 1.5.2 installation. Looked like it was working fine. Deleted old unnecessary backups.

    Looks like my page doesn’t validate. I didn’t realize for some time because I was using ad-blocking software, set to “ignore errors”. I disabled it the other day, and voila, html errors.

    I’ve tracked it down to something in my sidebar; I suspect I either have a missing or an extra [li] tag someplace.

    Would somebody with a fresh pair of eyes glance at it and see if my error is in an obvious spot? I haven’t been able to find it. 🙁

Viewing 11 replies - 1 through 11 (of 11 total)
  • hey there…

    1) i can spot a missing <ul> here:

    <!-- End Theme Switcher -->
    <li class="pagenav"><h2>Pages</h2><ul><li class="page_item">

    2) another missing <ul> before this <li>:

    <li id="calendar"><table id="wp-calendar">

    try that and see if you’re still getting errors…

    Didn’t work. 🙁

    I think the [ul] for those are up top at the [div id=”sidebar”]. I re-counted, re-paired all the li’s and ul’s in the sidebar.php and they all seem to close, but it still doesn’t validate.

    You have 111 errors, not 1.

    Looks like you have some unclosed <p> tags and your unclosed <li> tags are in posts. If you remember to hit the “Close Tags” quicktag before posting, you can eliminate some of that. Are you entering those tags manually? WordPress normally closes them when it inserts them.

    Er, thanks, but that’s not quite it. I’m convinced the 111 errors are actually 1 misplaced error in the sidebar. Most of those 111 errors occur within the posts on the front page, yet if I switch to the default WordPress Kubrick theme, all the posts validate with no errors.

    Actually most of the errors are fairly simple things that have nothing to do with the lists. You have a lot of border=0 that should be border=”0″, for example. If you fix those, it will be easier to track down the real problem.

    I cut and pasted just the code from your sidebar in the “Validate by Direct Input” and while it had 50 errors, they were none of them related to <li> or <ul> tags. They were almost entirely things like unescaped ampersands in javascripts and things related to the use of tables.


    How do you “paste the code from my sidebar?” That validator doesn’t work on php files.

    I don’t have your php file. The php file outputs HTML, which is what the browsers actually read and also what any validator that you input your URL into is going to see. Or if you click that “Valid XHTML” link on your blog, the validator will see the HTML that your server outputs, not the raw PHP file. I just did view page source, copy, paste.

    Validate the whole page, not just your sidebar. It won’t correctly determine the document type if you just do partial HTML.

    Anyway, just use the W3 Validator that was linked to above and do as it suggests.

    ViperBond,Sphyr convinced the error is in his sidebar and is an error related to a misplaced list tag of some sort. Sphyr won’t even look at the multiple errors elsewhere on the page, which is why I did the validation separately for just the sidebar. But ultimately the solution is to go through and fix the simple things like border=0 instead of border=”0″ in the whole page and get the list down to a manageable size.

    And the validator offers the option to specify the document type.

    Sphyr – if you can change two things it will cut your errors down to 36.

    In your Header template file change this:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">


    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"

    And change this:

    <html xmlns="">

    to this:


Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Tracking Down an HTML Error’ is closed to new replies.