Title: Validating Widget Errors
Last modified: August 18, 2016

---

# Validating Widget Errors

 *  Resolved [lauralohr](https://wordpress.org/support/users/lauralohr/)
 * (@lauralohr)
 * [18 years, 10 months ago](https://wordpress.org/support/topic/validating-widget-errors/)
 * I am trying to get my page validated and do not know how to fix the widget errors
   I am getting.
 * What I mean to say, is that I am unsure where to put the
    -  and
 *  that are associated with the
    -  items that are in the sidebar. (I hope that is clear)
    - My website is: [Laura Lohr](http://www.lauralohr.com) and is completely broken
      right now. I am trying to validate but am quite stumped what to do to correct
      these last 16 errors.
    - Your wisdom and assistance are greatly appreciated!

Viewing 9 replies - 1 through 9 (of 9 total)

 *  Thread Starter [lauralohr](https://wordpress.org/support/users/lauralohr/)
 * (@lauralohr)
 * [18 years, 10 months ago](https://wordpress.org/support/topic/validating-widget-errors/#post-597587)
 * I have been searching for the answer to this from every message board and every
   web designer I can contact. I have tried everything.
 * ANYONE?
 * That was I am having problems with the
    unordered list tags and line item elements
    - and
 * The links widget is giving me the following error:
 *     ```
       <li class="links widget widget_links"><h2 class="widgettitle">Laura</h2>
   
       The mentioned element is not allowed to appear in the context in which you've placed it; the other mentioned elements are the only ones that are both allowed there and can contain the element mentioned. This might mean that you need a containing element, or possibly that you've forgotten to close a previous element.
   
       One possible cause for this message is that you have attempted to put a block-level element (such as "<p>" or "<table>") inside an inline element (such as "<a>", "<span>", or "<font>").
       ```
   
 *  [moshu](https://wordpress.org/support/users/moshu/)
 * (@moshu)
 * [18 years, 10 months ago](https://wordpress.org/support/topic/validating-widget-errors/#post-597591)
 * Well, not having a closing `</head>` and an opening `<body>` tag in your markup…
   is always a bad start.
 * Just click the Show source boc on the validation page and Revalidate – all the
   line #s will become a clickable link, to admire the results:)
 *  Thread Starter [lauralohr](https://wordpress.org/support/users/lauralohr/)
 * (@lauralohr)
 * [18 years, 10 months ago](https://wordpress.org/support/topic/validating-widget-errors/#post-597615)
 * Thanks for your response.
 * I had not tried to click Show Source before. That was magical.
 * The reason I took out the </head> and opening <body> tag is that it broke my 
   layout. I cannot figure out how to get it work with the markup correct. I just
   put them back in and now everything is outside of the container (content, sidebar,
   footer, etc).
 * ETA: I added them back in with the <div id “container”> tag. But, now I am getting
   a new error for the head and body.
 *  [moshu](https://wordpress.org/support/users/moshu/)
 * (@moshu)
 * [18 years, 10 months ago](https://wordpress.org/support/topic/validating-widget-errors/#post-597617)
 * Well, you ca NOT have a valid html page/site without those tags. That’s not a
   way to correct the errors.
 * If yoou have it with the head and body back – I can see your site correctly in
   FF. But for pages that long I don’t look at the source, sorry.
 *  Thread Starter [lauralohr](https://wordpress.org/support/users/lauralohr/)
 * (@lauralohr)
 * [18 years, 10 months ago](https://wordpress.org/support/topic/validating-widget-errors/#post-597619)
 * I know I have to have the tags. I have literally tried EVERYTHING to have it 
   both ways.
 * I still have the errors on the widgets though. Any ideas why I am getting the
   error repeatedly:
 * Error Line 99, column 37: document type does not allow element “li” here; missing
   one of “ul”, “ol”, “menu”, “dir” start-tag .
 * <li class=”links widget widget_links”><h2 class=”widgettitle”>Upcoming Races</..
 * The mentioned element is not allowed to appear in the context in which you’ve
   placed it; the other mentioned elements are the only ones that are both allowed
   there and can contain the element mentioned. This might mean that you need a 
   containing element, or possibly that you’ve forgotten to close a previous element.
 * One possible cause for this message is that you have attempted to put a block-
   level element (such as “<p>” or “<table>”) inside an inline element (such as ““,“
   <span>”, or “<font>”).
 *  [moshu](https://wordpress.org/support/users/moshu/)
 * (@moshu)
 * [18 years, 10 months ago](https://wordpress.org/support/topic/validating-widget-errors/#post-597622)
 * Every list has to start with `<ul>` (if unordered as in a WP sidebar).
    Yours
   is missing that.
 *  Thread Starter [lauralohr](https://wordpress.org/support/users/lauralohr/)
 * (@lauralohr)
 * [18 years, 10 months ago](https://wordpress.org/support/topic/validating-widget-errors/#post-597626)
 * OMG! Thank you so much. I appreciate all your feedback. I needed a fresh pair
   of eyes. I just realized the code I am utilizing for the blogroll is <?php get_links;?
   >. I suspect that is where my problem lies.
 * I am off to change the code to <?php wp_list_bookmarks; ?>
 * I suspect my problems with those errors will be resolved shortly.
 * My navigation/menu bar is actually placed UNDER the header now too. I have been
   trying to fix that for two days now!
 * THANK YOU! THANK YOU!
 *  [Root](https://wordpress.org/support/users/root/)
 * (@root)
 * [18 years, 10 months ago](https://wordpress.org/support/topic/validating-widget-errors/#post-597627)
 * Lol 🙂
 *  Thread Starter [lauralohr](https://wordpress.org/support/users/lauralohr/)
 * (@lauralohr)
 * [18 years, 10 months ago](https://wordpress.org/support/topic/validating-widget-errors/#post-597651)
 * I discovered the problem was not me at all, but several problems with the widget.
   php file.
 * These are the problems I ran into:
 * 1. The “onchange” command for the archive dropdown was listed as “onChange” which
   caused several errors.
 * 2. <script language=”Javascript”> is written as <script lang=”Javascript”>
 * 3. Even written correctly, <script language=”Javascript”> is a deprecated tag
   and should be <script type=”text/javascript”> to render no validation errors.
 * 4. I was getting an error similar to this one TWENTY-SEVEN TIMES (that is 27 
   errors):
 *  Error Line 481 column 8: ID “links” already defined.
    <li id=”links” class=”
   widget widget_links”><h2 class=”widgettitle”>www</h2>
 * It was also telling me that my li were missing ul’s (which they weren’t, it was
   the widget.php causing the problem). Finally, after combing through many websites,
   forums, posts, asking for help and getting nowhere, I found this:
 * – On wordpress 2.2.1 you have to add :
    $before_widget = preg_replace(‘/id=”[
   ^”]*”/’,’id=”%id”‘, $before_widget); before line 397 (after the } else { )
 * That error does not appear to have been fixed in the new release of WordPress.
 * I am down to 3 errors and have had no success in getting any help clearing those.

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Validating Widget Errors’ is closed to new replies.

## Tags

 * [sidebar](https://wordpress.org/support/topic-tag/sidebar/)
 * [validation errors](https://wordpress.org/support/topic-tag/validation-errors/)
 * [widgets](https://wordpress.org/support/topic-tag/widgets/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 9 replies
 * 3 participants
 * Last reply from: [lauralohr](https://wordpress.org/support/users/lauralohr/)
 * Last activity: [18 years, 10 months ago](https://wordpress.org/support/topic/validating-widget-errors/#post-597651)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
