wrong wp_nav_menu displayed

my url looks like this: http://domain.com/?s=searchquery&post_type=qa_faqs

that page lists search results for "searchquery".

i then get the post type with

$post_type = $_GET['post_type'];

it echoes correctly

echo $post_type;
// Provides: qa_faqs

i then do an if/else to display a different menu via wp_nav_menu when $post_type is qa_faqs.

if ( $post_type == 'qa_faqs' ) {
  echo 'we got qa_faqs over here';
  wp_nav_menu(array('menu' => 'meta_menu', 'items_wrap' => '<dl id="%1$s" class="nice tabs vertical %2$s">%3$s</dl>', 'walker' => new sidenav_walker ));
} else {
  echo 'no qa_faqs in da house';
  wp_nav_menu(array('menu' => 'service_menu', 'items_wrap' => '<dl id="%1$s" class="nice tabs vertical %2$s">%3$s</dl>', 'walker' => new sidenav_walker ));
}

now to the funny part:

even though the page echoes 'we got qa_faqs over here', it displays the service_menu.

why´s that?

Answers


Found it - http://codex.wordpress.org/Navigation_Menus

Same problem was driving me nuts aswell.

Use 'theme_location' instead of 'menu' to point to which menu you want to output.


Try targetting the specific menu with something like:

<?php wp_nav_menu( array('menu' => 'Your Menu Name' )); ?>

I think you dont have any items on the meta_menu. Please create menu under Appearance section and assign it. :)


Need Your Help

Converting Bitmap in memory to Bitmap with Bitmap.Config.RGB_565

android bitmap rgb bitmapfactory

I have a loaded Bitmap which I would like to convert to set the config to Bitmap.Config.RGB_565. Is there a simple way of converting a Bitmap to this configuration after the Bitmap is already loade...

Play! 2.0 Scala - Accessing global object

scala global sbt playframework-2.0

I've declared an object which gets instantiated on application start. I want to access it inside a controller, which is part of a plugin. I want to be able to use that plugin, but I can't seem to get