WordPress.org

Ready to get started?Download WordPress

Forums

XHTML Validator Question (3 posts)

  1. subtype
    Member
    Posted 6 years ago #

    The error:

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

    <h2>Search:</h2>
    ----------

    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 -->
    
    <ul>
        <?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'")) { ?>
    </u>
    
    <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 } ?>
    </div>
        <?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>
    </div>
        <br/><br/>
        <?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!'); ?>" />
        </form>
    
        <h2>Product Categories</h2>
    <ul class="sidemenu">
        <?php wp_list_cats(); ?>
    </ul>
    
        <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>
        </li>
    </ul>
    <?php endif; ?>
    
    <!-- end sidebar -->
    </div>
    <div class="clearer"><span></span></div>
    </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
    Member
    Posted 6 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. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    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

Tags

No tags yet.