A simple way to achieve that is to create two separate Navigation Menus (/wp-admin/nav-menus.php
), and in your theme use the following:
// Reference:
// http://codex.wordpress.org/Function_Reference/is_user_logged_in
// http://codex.wordpress.org/Function_Reference/wp_nav_menu
if( is_user_logged_in() ) {
wp_nav_menu( array( 'theme_location' => 'logged-users' ) );
} else {
wp_nav_menu( array( 'theme_location' => 'not-logged-users' ) );
}
Instead of theme_location
, you can use the menu name directly, check the documentation for wp_nav_menu
.
And you’d probably would like to use the function is_user_logged_in
in the template files for the Registration and Directory pages.
Related Posts:
- if role is logged in then do something
- how to assign more permission to wordpress author
- Make pages visible to only logged in members
- if role is logged in then do something
- Users are required to login to my site. How define user.member boolean, its permissions, and conditionally display/handle behavior based on it
- Hide page link in main menu from anonymous users
- Show different menus for login / logout user [closed]
- wp_get_nav_menu_items() not working with slug
- Error “Trying to get property of non-object” with Custom Walker for wp_nav_menu
- Add Class to Specific Link in Custom Menu
- How to avoid wp_nav_menu() ID conflict?
- Remove unusable metaboxes in nav menu management screen
- Highlight parent menu item when child is not in menu
- wp_nav_menu() loses ‘current-menu-*’ classes on single product page within category
- How is custom menu hierarchy output handled?
- Creating new dynamic menu including BP links [closed]
- Building a Sub-menu: Display Parent Category/Page’s Children When Viewing Children
- List parent item with all child item on child pages
- Output the aria-labelledby parameter for a nav menu child
- Hide menu items for visitors and filter based on role
- Add a “has-children” class to body tag?
- Custom Nav Walker sub-menu HTML construct
- How to remove trailing tags from wp_nav_menu walker
- How to scroll item in the Menu setting effectively?
- Building custom API and using wp_get_nav_menu_items to get menu items. Only works when logged in, returns nothing when I’m not
- How to display dynamic content in start_lvl function
- Appearance -> Menu -> Menu Structure : Add plain HTML code as an element
- Add custom -element to wp_nav_menu
- Disable automatig SVG tag from menu
- Replace menu permalink/hyperlink with only menu name/slug
- wp_nav_menu add some element to container
- Menu Item Location
- get_query_var(‘post_type’) not returning in a filter
- How do I apply a class to custom menu items based on user roles
- Menu API not switching menus?
- Navigation Menus Depth for specific menus
- How do you manage large menu hierarchies in WP?
- Using Walker To Add Menu CSS Class Functionality
- how can remove this element to avoid having two menu buttons with one that shows unnecessary pages
- How to make next and previous button based on a menu
- How to combine multiple categories in one Menu item?
- WordPress Menu Walker: add #hashes to child page links (only)
- add_filter on menu items to add a menu item
- WordPress Walker – Group two items?
- Custom Menu’s – Disable Link checkbox
- Unlimited WordPress Menu
- Using my WordPress menu on another platform
- Header and nav menu problem on Thesis site [closed]
- Remove a menu sub-item
- How to remove menu labels in word press?
- modify menu item links dynamically
- Adding numbers inside a span tag in nav menu [closed]
- I’m using wp_nav_menu to display my menu, but I want one more link in there that is a hardcoded link. How can I do this?
- Is there a hook for nav menu item links to add custom css programatically?
- sub menu link is not working
- Disable parent in wp_list_pages – WordPress
- Add scheduled page or post in the menu section on back-end
- Hoverable menu to appear in different sections of page
- Show Sidebar Menu Subpages When Clicking Parent
- Secondary menu in WP 4.5
- Change link in menu on condition
- Current User In Custom Menu Item URL [closed]
- Creating other page than page.php
- Appearance > Menus > Left Sidebar > Add Toggle
- Custom menu styling
- Echo Menu located in primary navigation
- Additional navigation bar in header
- Dynamically populate the menu when a new category is created
- Is there any difference between widgets (used in order to manage menus) and register_nav_menus() in terms of performance?
- Menu items not clickable
- How do you show horizontally the submenu in WordPress using the nav walker?
- Adding menu title to custum URL
- Add “onclick” option to header menu item
- Full submenu not displaying in wordpress
- 2nd level (drop-down) of the navigation menu not working [closed]
- Mobile menu not working – jQuery error?
- show a hidden ul if li is active
- How can I make menu items into two seperate buttons with different functions?
- Responsive Dropdown Menu
- Header lists posts instead of showing primary nav menu
- How to separate sub-menu output and keep associated with parent
- Different colors for navigation bar
- Eliminate menu collapse button on website
- Best way to build a 500 item menu
- Count Level 1 Childs for Custom Nav Walker WordPress
- Iterate through each menu item into a shortcode
- Showing main menu and child menu in diffent places in a same page
- “Static” Child Menu with Accordian
- Display same menu for parent and all its children
- Image menu on responsive WordPress
- Specifying Class style for Menu
- Auto Filled Custom Menus for Custom Post Types?
- Convert HTML code to WordPress menu
- How to view menu and submenus in URL
- Permalinks linking to similar named site
- Adding Pages to Menus – No Page Hierarchy in Backend [duplicate]
- Custom navigation / menu output (walker?)
- How does WP knows which template to use for a page
- Problems with draft website pages
- add dynamic ID for wp_nav_menu after and before