Ideally, you should be passing the “theme_location” argument to wp_nav_menu().
Register your three menus in functions.php:
register_nav_menus( array(
'front_page' => 'Front Page Menu',
'single' => 'Single Post Menu',
'default' => 'Default Menu'
) );
Then, replace your code above with:
if ( is_front_page() )
{
wp_nav_menu( array( 'container_class' => 'menu-header', 'theme_location' => 'front_page' ));
}
elseif ( is_single() )
{
wp_nav_menu( array( 'container_class' => 'menu-header', 'theme_location' => 'single' ) );
}
else
{
wp_nav_menu( array( 'container_class' => 'menu-header', 'theme_location' => 'default' ));
}
Then, ensure the appropriate custom menu is defined for each Theme Location, via Dashboard -> Appearance -> Menus
Related Posts:
- wp_nav_menu: check if the list item has children and add a class to anchor link
- Add custom meta to nav menu items
- Display navigation menu item conditionally based on user capabilities
- Remember the last post I read
- Export navigation menu
- Prev/Next child navigation for current page?
- List child pages of a specific page
- How to modify the “after” of last element in wp_nav_menu
- How do I retrieve menu items from one level only?
- Edit HTML of WordPress navigation bar
- Using FlexNav with WordPress [closed]
- How to make Next and Previous attached image navigation on the attachment page? [duplicate]
- Get only the path from a function like previous_post_link
- Can this navigation be done easily in WordPress?
- Making some links generated from the wp_nav-menu function unclickeable?
- Previous & Next on Index Page broken
- Twenty Eleven theme- have custom landing page, change nav “home” link
- posts_nav_link on single.php
- I need ideas for a complicated menu
- How to get back to same page of post-list – after updating a post
- how to change site tag line for particular pages
- dropdown navigation menu
- How to add show/hide in navigation setting for pages
- How Do I Add Next and Previous Links On Single Custom Post Type Only?
- Menu with parents, children and or siblings pages display
- Inserting specific images inside navigation menu
- Select first child/subpage item in wp list pages
- Fallback_cb is messing around with containers
- Only show top-level links in site navigation
- wp_list_pages to show all pages on all sub pages
- WordPress – Responsive navbar doesnt work
- get_adjacent_post – in same term or category not working
- Exclude post format from navigation
- How to make previous_post_link into an image [duplicate]
- How to add swipe action to wordpress pages
- Can I use multiple nav_walkers?
- (Bluehost) navigating to the dashboard via mydomain.com/wp-admin/ results in directory listing
- Implementing the twentythirteen responsive menu in twentytwelve
- Using characters to separate menus in navigation bar
- How to hide ‘Home’ button from appearing on supages – twenty eleven theme
- Check if current post is the latest (not last)
- How does the Twenty Twelve Navigation Bar work?
- Switch form Next/Previous to post title
- add a menu item to navigation menu to link to external url
- Using categories on navigation bar instead of pages
- body_class(); not working with bootstrap navbar fixed top?
- Display greyed out nav link when there’s not a next or previous post
- Ussing page_navi with WP_Query
- Set custom id to list element walker custom function
- Ecommerce Single Product Next Product Link
- Top Nav submenus wpon’t stay open – only in FF and only sometimes [closed]
- Display all posts thumbnails when viewing a single post
- Is wp3.8 / twenty fourteen’s Sticky Nav & Responsive – core or theme based
- Modifying navigation menu classes with a Walker
- Add ID to target navigation link
- New Page Position
- Possible to hide Page if no posts from a CPT?
- Listing Sub-Pages & Sub-Sub-Pages
- navigation doesn’t work in custom header.php
- Next/Previous links doesn’t work in the same category
- WordPress navigation only shows post of page one, even if on page two
- only show children of a nav menu
- Depth problem using wp_list_pages for subnavigation
- WordPress change wp_nav_menu walker with a custom one
- Navigating WordPress Articles From Parent Category?
- is_tax() conditional tag not working
- WP Bootstrap Nav (not JS, not missing ID)
- Dynamic next and previous post links
- How to echo site url if not on index.php while using anchor based nav
- Pagination always shows 0 in post section wordpress admin panel
- Current Post Parent Category & Child Category Links
- Problem with sub-menu container
- Navigation template
- Category navigation template
- Connect custom rewrite rules and query variables to wordpress navigation
- How to remove anchor of current menu item in navbar?
- Walker_Nav_Menu Add Strings and Class Name
- Adding direct link to post editor in admin menu
- How to remove the word “Navigation” from the top of the mobile main menu?
- Add default wp_nav_menu classes to my custom links
- Forcibly show previous/next links
- How to add navigation in footer like StackExchange?
- HTML-to-WordPress: Dropdown Navigation Menu [closed]
- Adding nav menu name from plugin options dynamically
- Foundation 5 Dropdown Top Bar not working in WordPress
- Using Different nav_menu_css_class for different nav_walkers
- How to retain responsive navigation menu in twentyeleven child theme
- Custom navigation bar via wp_list_pages is broken for blog roll
- All of the “more results” and navigation links lead to a 404 error
- How can I set the first link in my nav menu to simply be a drop-down to some other pages
- first_post_link and last_post_link? [duplicate]
- Creating a custom menu with images as each link
- determine if specific page is in list?
- Navigation dropdown issue, need it to work on hover
- All navigation fails and leads me to homepage
- add additional anchors in navigation menu
- Previous / next posts using featured image thumbnail as links
- I would like to hide menu on desktop but still have it visible on small screen
- How to add nofollow to the_post_navigation?
- Apply walker_nav_menu_start_el but only to one menu