Support » Themes and Templates » Having trouble with header menu in wp theme.

  • Dashel

    (@dashellathers)


    So my theme isn’t coded with a header menu in the header yet. I put the code in and the menu is just stuck at the top of the page and not in the opaque box where I want it.

    Could someone help me with the css/html of this? Below is my header.php code.

    <?php
    /**
     * @package WordPress
     * @subpackage Default_Theme
     */
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
    
    <head profile="http://gmpg.org/xfn/11">
    <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
    
    <title><?php wp_title('&laquo;', true, 'right'); ?> <?php bloginfo('name'); ?></title>
    
    <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />
    <!--[if lt IE 7]>
            <script type="text/javascript" src="wp-content/themes/wildflower/unitpngfix.js"></script>
    <![endif]-->
    <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
    
    <?php wp_nav_menu( array( 'theme_location' => 'header-menu' ) ); ?>
    
    <?php if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); ?>
    
    <?php wp_head(); ?>
    </head>
    <body>
    <div id="header">
    
    <div id="header-container">
    
    </div>
    </div>
    <div id="page">
Viewing 3 replies - 1 through 3 (of 3 total)
  • You’ve got your call to wp_nav_menu() in the wrong place. The HTML <head> tag is different from the WordPress definition of the header: The HTML tag is for various information about the document and you can also load JavaScripts, stylesheets, etc. The call to wp_nav_menu() should be near the bottom of the code snippet you posted, between <div id="header-container"> and </div>.

    Thread Starter Dashel

    (@dashellathers)

    now it is still up at the top… help lol

    Can you post the contents of your revised header.php?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Having trouble with header menu in wp theme.’ is closed to new replies.