Support » Fixing WordPress » Help switching logged in menu and logged out menu

  • MeAgainAtPMP


    I have two web sites running WordPress 3.5 with Theme Twenty Eleven. I am trying to set them up the same to make it easier to manage. On both web sites I have two menus named loggedin and loggedout. I used the code below in functions.php to switch the menus based on the user being logged in or not. This works on one web site and not the other. Can anyone show me how they modified functions.php to switch menus. Then maybe I can figure this out. Thanks

    // This theme uses wp_nav_menu() in one location.
    register_nav_menu( ‘primary’, __( ‘Primary Menu’, ‘twentyeleven’ ) );
    //I ADDED THE TWO LINES BELOW. MY MENUS ARE loggedin AND loggedout
    register_nav_menu( ‘primary’, __( ‘Logged In Menu’, ‘loggedin’ ) );
    register_nav_menu( ‘primary’, __( ‘Logged Out Menu’, ‘loggedout’ ) );

Viewing 1 replies (of 1 total)
  • jibbius


    Not twentyeleven, but I do this:

    						if ( is_user_logged_in() ) {
    							wp_nav_menu( array( 'container' => false, 'menu_id' => 'nav', 'theme_location' => 'loggedin', 'fallback_cb' => 'bp_dtheme_main_nav' ) );
    						} else {
    							wp_nav_menu( array( 'container' => false, 'menu_id' => 'nav', 'theme_location' => 'primary', 'fallback_cb' => 'bp_dtheme_main_nav' ) );
Viewing 1 replies (of 1 total)
  • The topic ‘Help switching logged in menu and logged out menu’ is closed to new replies.