XHTML Validator Question (3 posts)

  1. subtype
    Posted 8 years ago #

    The error:

    Line 145 column 7: document type does not allow element "h2" here; assuming missing "li" start-tag.


    I assume it is asking me to put DIV tags around the H2 tags, correct? The problem is I do have a separate DIV assigned for the search form and the H2 - Search - /H2 is between those tags...

    Sidebar code:

    <div class="sidenav">
    <!-- sidebar -->
        <?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar() ) : else : ?>
        <?php global $notfound; ?>
        <?php /* Creates a menu for pages beneath the level of the current page */
        if (is_page() and ($notfound != '1')) {
        $current_page = $post->ID;
        while($current_page) {
        $page_query = $wpdb->get_row("SELECT ID, post_title, post_status, post_parent FROM $wpdb->posts
        WHERE  ID = '$current_page'");
        $current_page = $page_query->post_parent;
        $parent_id = $page_query->ID;
        $parent_title = $page_query->post_title;
        if ($wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_parent = '$parent_id' AND post_status
        !=  'attachment'")) { ?>
    <div class="sb-pagemenu">
        <h2><?php echo $parent_title; ?> <?php _e('Subpages:'); ?></h2>
        <ul><?php wp_list_pages('sort_column=menu_order&title_li=&child_of='. $parent_id); ?></ul>
        <?php if ($parent_id != $post->ID) { ?>
        <a href="<?php echo get_permalink($parent_id); ?>"><?php printf(__('Back to %s'), $parent_title ) ?></a>
        <?php } ?>
        <?php } } ?>
        <?php if (is_attachment()) { ?>
    <div class="sb-pagemenu">
        <a href="<?php echo get_permalink($post->post_parent); ?>" rev="attachment"><?php printf(__('Back
        to \'%s\''), get_the_title($post->post_parent) ) ?></a>
        <?php } ?>
        <h2><?php _e('Search:'); ?></h2>
        <form id="searchform" method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>">
        &nbsp;&nbsp;&nbsp;<input type="text" name="s" id="s" size="10" />
        &nbsp;<input type="submit" value="<?php _e('Go!'); ?>" />
        <h2>Product Categories</h2>
    <ul class="sidemenu">
        <?php wp_list_cats(); ?>
        <h2><?php _e('Meta:'); ?> </h2>
    <ul class="sidemenu">
        <?php wp_register(); ?>
        <li><a href="http://validator.w3.org/check/referer" title="<?php _e('This page validates as XHTML
        1.0 Transitional'); ?>"><?php _e('Valid <abbr title="eXtensible HyperText Markup
        Language">XHTML</abbr>'); ?></a>
    <?php endif; ?>
    <!-- end sidebar -->
    <div class="clearer"><span></span></div>

    CSS Code:

    /* sub navigation */
    .sidenav {
    	float: right;
    	width: 210px;
            background-color: #E8E5DD;
    .sidenav h2 {
    	color: #333300;
    	font-size: 1em;
    	line-height: 30px;
    	margin: 0;
    	padding-left: 12px;
    .sidenav ul {
    	padding: 0;
    .sidenav li {border-bottom: 1px solid #D2D3BD;}
    .sidenav li a {
    	font-size: 1.1em;
    	color: #333300;
    	display: block;
    	padding: 6px 0 6px 5%;
    	text-decoration: none;
    	width: 95%;
            background-color: #E8E5DD;
    .sidenav li a:hover {
    	background-color: #E8E5DD;
    	color: #654;

    Where's my error?

  2. Marcel Brinkkemper
    Posted 8 years ago #

    It looks like you've missed a , but that could be a copy/paste error. Anyhow, you'd better look at the code that is actually displayed on your browser. That is what is validated.

  3. We really need a link to your page (or better yet, a link to the validator results for your page).

    Just posting the theme code doesn't much help us, in this case.

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.