Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

WP 3.0 Navbar Broken in IE6 and IE7 WordPress

  • SOLVED

Using the [[LINK href="http://www.studiopress.com/themes/allure"]]Allure theme[[/LINK]] by [[LINK href="http://www.studiopress.com/"]]StudioPress[[/LINK]], I added WP 3.0 menu functionality to be used for the navbar.

In IE6 and IE7, all of the navbar items appear as dropdowns under the "Home" button.

I haven't had the time to pinpoint what I need to adjust to make a fix.

Could you look at my code and help me determine what I need to tweak to get the menu to appear normal in IE6 and IE7?

[[LINK href="http://rebuildingtogethermuscatine.org"]]http://rebuildingtogethermuscatine.org[[/LINK]]

Answers (3)

2010-09-23

Victor Teixeira answers:

I need to see the code of the theme. Usually the header.php file.

There's really something wrong with your code since the generated html is wrong.
There's a div and another ul nested inside the nav ul.

Put the file on http://gist.github.com or http://pastebin.com or another place where I can check it.


Victor Teixeira comments:

Actually you don't need this code in functions.php to remove the container div.

The full menu code for your menu should be this:


<div id="navbar">
<?php wp_nav_menu( array( 'menu' => 'the_menu_name', 'menu_id' => 'nav', 'menu_class' => 'menu', 'container' => '' ) ); ?>
</div>


Where the_menu_name should be changed by the name of the menu created on the wordpress interface.

If the Home link then disappears from your menu, just add it on the menu management page inside wordpress admin panel.

That's it


Ethan Anderson comments:

Victor, I tried this and it worked great. The menu now works in IE6 and IE7, with one glitch: The Home link on the menu is not highlighted when I'm on the home page. How do I remedy this?


Ethan Anderson comments:

Here's the header.php

http://gist.github.com/594298


Victor Teixeira comments:

I see that you put / as the home menu link address.
Try changing this to http://rebuildingtogethermuscatine.org/

Let's see if it works.


Ethan Anderson comments:

Done. No luck.


Victor Teixeira comments:

Replace the code from line 28 to 34 on your header.php with this:


<body id="<?php echo (is_home()) ? 'home' : 'site' ; ?>">

<?php include(TEMPLATEPATH."/header_options.php");?>

<div id="navbar">
<?php wp_nav_menu( array( 'menu' => 'main_menu', 'menu_id' => 'nav', 'menu_class' => 'menu', 'container' => '' ) ); ?>
</div>



Then on your style.css add this:


#home #nav .menu-item-home a { background: #4EA737; }


This is the simplest solution to the problem.


Ethan Anderson comments:

Ok, I tried just what you suggested, but it still didn't do the trick.

Thanks for your help with this - any other ideas?


Victor Teixeira comments:

I looked at your site and it's not adding the home id to the body.

Did you put this on the body: <body id="<?php echo (is_home()) ? 'home' : 'site' ; ?>">

If you put and it didn't work try this instead:

<body id="<?php echo (is_front_page()) ? 'home' : 'site' ; ?>">

All we need is the id="home" on the body tag of the homepage.

This is the complete code:


<body id="<?php echo (is_front_page()) ? 'home' : 'site' ; ?>">

<?php include(TEMPLATEPATH."/header_options.php");?>

<div id="navbar">
<?php wp_nav_menu( array( 'menu' => 'main_menu', 'menu_id' => 'nav', 'menu_class' => 'menu', 'container' => '' ) ); ?>
</div>


Ethan Anderson comments:

Ahhh Victor! I forgot that I was using a caching plugin. Turning off caching made the changes appear and work fine. I suppose it was the caching that was preventing me from seeing the change the first time. I didn't have to add your latest code.

Now it seems to be working great, and I am very grateful to you for your help.

Thanks 1,000,000.

Ethan

2010-09-23

Cosmin Popovici answers:

You have a div after the Home link, div which holds another UL

Your code should look like this:

<ul>
<li>Home</li>
<li>About
<ul>
<li>Subpage</li>
</ul>
</li>
</ul>


Remove any code from the div with the id of navbar and make sure you're calling the menu right:

<?php wp_nav_menu( array( 'menu_id' => 'nav', 'menu_class' => 'nav', 'theme_location' => 'primary' ) ); ?>

Also, add this in functions.php, to remove the menu container div:

// remove menu container div
function my_wp_nav_menu_args( $args = '' )
{
$args['container'] = false;
return $args;
} // function
add_filter( 'wp_nav_menu_args', 'my_wp_nav_menu_args' );


Hope it helps :)

2010-09-23

Kailey Lampert answers:

Without seeing the original code, it's hard to tell for sure, but it looks like you might have something like this going on:

<ul id="nav">
<?php wp_list_pages(...); ?>
<?php wp_nav_menu(...); ?>
</ul>


the wp_list_pages() appears to only be calling the home page, so I'd just move that into whatever custom menu you're using and remove the <ul>s and wp_list_pages() function from the theme leaving this:


<?php wp_nav_menu(...); ?>