add_action('init','wpsites_members_menu');
function wpsites_members_menu(){
if(is_user_logged_in()){
add_filter( 'wp_nav_menu_args' , 'logged_in_nav_menu' );
}
}
Display Different Nav Menu For Logged in and Logged Out Users
Source: http://wpsites.net/web-design/members-nav-menu-logged-in-members/
function logged_in_nav_menu( $args ) {
if ( $args['theme_location'] == 'primary' ) {
$args['menu'] = 'members';
}
return $args;
}
Related Posts:
- Add custom classes to anchor in wp_nav_menu
- How do I add support to my theme for custom menus?
- Any official way to create an admin theme?
- Creating Multiple Menus when using the TwentyTen Theme?
- Two Navigation Menus in Themes Produce the same menus?
- Displaying wp menus by name without using theme locations
- Setting a Default ‘Theme Location’ When Creating a Menu
- Two Navigation Menus – secondary nav is including main nav
- How to remove background image from post navigation elements?
- My Admin bar covers my sticky navbar [closed]
- How to find out if page_for_posts is showing (in order to style menu item)
- how to remove category nav from Bueno (WordPress Theme) header [closed]
- Most wp_nav_menu parameters ignored
- Default Nav Highlight
- How to remove the tripadvisor logo from the wordpress theme?
- Make a menu item unselectable
- How can I fetch the next level of the currently selected main menu (hierarchical menu)?
- Custom theme – pages in menu
- WordPress site hamburger menu toggle not working
- WordPress Menu Navigation links not working
- Target Internal Link Of Another Page On Website
- Theme Options Menu Item – Permission Issue
- Lightword Theme – only one menu item
- How to make navigation a list without a plugin? [duplicate]
- How to add or remove borders in navigation menu?
- Prevent primary navigational menu from expanding during page load (WordPress / Astra Theme)
- W3 Total Cache, CDN and theme files [closed]
- Dynamic template serving, change theme_root using add_filter from current theme
- Splitting an Evolving Site into Multiple Sites, or Maintaining as One Site?
- Call custom field into menu item
- Exclude Private, Draft pages from Primary Nav when using custom menu
- How to use same theme template for multiple taxonomy terms?
- WP Video media player not loading correct CSS after AJAX load
- Not able to get current menu ID
- Copying theme from Localhost to Live does not copy all theme settings with it?
- Register theme customizer settings when theme activates [duplicate]
- hfeed CSS class in Twentyeleven Theme
- Which is the most well coded and semantically correct naked/blank WordPress theme (based on WordPress coding standards)?
- WordPress wp_nav_menu with a nav tag
- How to change the themes “Live Preview” url within the Appearance->Themes page?
- `start_el` depth argument in custom nav walker always evaluates to zero
- Programmatically set current-menu-item using wp_nav_menu
- How can I add a custom class to only nav sub-menu > li > a items in WordPress?
- How to get the post-ID in my plugin?
- Parallax WordPress theme without hardcoding – possible?
- Recommended Themes for a Developer-related Topics Blog?
- Custom branding / theme specified by URL
- New custom theme option (text input) giving index error
- Upgrading from 2.9.4 to 3.0.x and with a custom theme
- How to create a submenu that will navigate through different posts in the same page
- CSS for triggering Avada toggles using an image or clickable element [closed]
- Change WordPress Theme automatically for A/B test
- wp_page_menu not working right?
- What is the correct way to integrate wordpress with another php application?
- The Cost of Installing Custom Themes
- Can I create a child theme from a premium theme without losing my posts and page etc that I already have?
- wordpress theme install failing
- WordPress suddenly creating theme errors
- Menu Arrow for Child Element
- Re-skinning Site
- How to reset a custom theme
- Menu separator appearing on next line
- Add a counter beside menu item label
- Warning : Invalid argument supplied for foreach() in theme php on line 56 [closed]
- Why submenu item’s background color is not changing by css?
- How to edit the font color of the H1 on a single page?
- Multiple navigation menu in same location
- Cannot see theme in my search
- What login/password do I need to install a wordpress theme?
- Add pages content to startpage through custom menu
- get_pages Not accepting my query
- Remove the Tag from wp_nav_menu
- Date based CSS/theme
- Functions.php error – when trying to change the theme
- Add user managable titles to custom menus?
- conditional statement if wordpress theme block is empty then hide block
- Can I use non-wordpress themes in WordPress?
- Get Each Menu Nav Label of Menus in HTML tag
- Set custom directory in theme for page templates
- 3 Level Menu Navigation (3rd Level not displaying)
- How can I click the parent menu then redirect to a special URL?
- fixing page URL’s
- Don’t prepend WordPress base url to image paths
- Navigation bar is on live site but nothing under menu so can’t add in a page
- Change name of WP content > Themes folder
- How to get dynamic template-function generated CSS into HEAD?
- Show part of front page on another page [closed]
- Premium theme – hardcoded url?
- Any Mobile Theme Switcher – Theme not complete (Stylesheet missing)
- Add the “.current-menu-item” class to tag?
- Categorising themes by folders in backend
- My site looks different when activating new theme
- Rest API does not work after changing WordPress Theme
- totally confused about editing wp theme….new guy to wp
- WooCommerce My Account Shortcode
- How to change twentytwelve child theme site title separator
- Header Paperpunch theme disappers with IE9 [closed]
- Why does twentysixteen take a free hand in dealing with longstanding usability principles? [closed]
- File execution order
- Custom Theme Additonal CSS “” are transformed to “>” and “<”