Custom menu missing on search page.
-
I’ve been scratching my head over this one, so thanks in advance for any help. Much appreciated.
I’ve got a menu in WP 3.0.1 which I call in header.php using:
wp_nav_menu( array( 'container_class' => 'menu-header', 'theme_location' => 'primary' ) );It’s showing up fine on every page **apart** from search results. The search.php file starts with a standard
get_header();so it must be thewp_nav_menucode right? But nothing’s wrapped in anis_search()conditional or anything.The output HTML should look like this:
<div class="menu-header">
<ul id="menu-main-menu" class="menu">
<li class="menu-item">
<a>Link 1</a>
</li>
<li class="menu-item">
<a>Link 2</a>
</li>
</div>But instead, it gets as far as the
<ul>and doesn’t output any<li>s:<div class="menu-header">
<ul id="menu-main-menu" class="menu">
</div>Most strange. Has anyone else come across this before? Is it just far too late and I’m missing something obvious?
-
Are you using custom post types?
i know this is an old post but I’m having exactly the same problem…
menu fine everywhere except the search results page where it gets as far as<div class="menu-main-menu-container"><ul id="menu-main-menu" class="menu"></ul></div>but no further.Strangest thing for me is that this works fine on my localhost version but is not working on the live site.
Anyone got ANY ideas on how to fix it? Or what tests to do??
thanks
in answer to arstropica above, I have two custom post types that are used solely for the homepage (one is being made by a plugin, the other I have added myself).
ok i found out the answer. Basically for me it’s the Search Everything plugin that is messing with my main menu. If I select a category to be excluded from search then the menu disapperas. If i don’t have any categories excluded then the menu re-appears.
The topic ‘Custom menu missing on search page.’ is closed to new replies.