Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have three main directories in my site, and I'm wanting to display one unique menu for each directory and display it on each child of that directory. I'm thinking I create my three custom menus, but then what would be the best way to display the correct one for each section?

Thanks for your help!

share|improve this question
add comment

1 Answer

Yes, create 3 custom menus and use a conditional.

Example you have 3 custom menus named, Products, Services,Training.

Open the section of the page you want to insert code in the header.php or where ever you need it. file and use:

if (is_page( array( 42, 'Products' ) )) {
  wp_nav_menu('menu' => 'Products');
}elseif(is_page( array( 2, 'Services' ) )) {
  wp_nav_menu('menu' => 'Services');
}elseif(is_page( array( 42, 'Training' ) )) {
  wp_nav_menu('menu' => 'Training');
}else {

}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.