How to Switch between multiple menu structures AND get the associated home page
-
Hi all,
Not sure if I’m in the right category, but I think it’s more development than any of the other ones!I have created three menu structures: Public, Members and Development.
Through php code snippets, these are accessible by: “Public” by open access, “Members” to anyone logged in and “Development” to specific users. The code is as follows:
function my_wp_nav_menu_args( $args = '' ) { $args['menu'] = 'Public'; // Set default if( is_user_logged_in() ) { $args['menu'] = 'SSN Members'; } //Overwrite with development menu if WebMaster $user = wp_get_current_user(); if($user && isset($user->user_login) && 'WebMaster' == $user->user_login) { $args['menu'] = 'D-Development'; }; return $args; }; add_filter( 'wp_nav_menu_args', 'my_wp_nav_menu_args' );
When members or admin are logged in they see the members menu structure by default, which includes menu items to switch between Public, Members and Development views of the site.
I can switch between the views using Custom Links with the URL of each areas home page, but that doesn’t change the menu structure associated with that page. (For example, if I am a logged in user and I switch to the Development menu structure it displays the Development home page but with the Members menu structure.
How can I make the ‘switch view’ menu items switch to the target home page AND display the associated menu structure? I’ve tried various php functions without success, and in any case I can’t find a way of triggering a php function(s) from a menu item.
Many thanks in advance.
Cheers
…Steve
- The topic ‘How to Switch between multiple menu structures AND get the associated home page’ is closed to new replies.