• I want a different menu displayed for logged in users to normal visitors to the site. I have done this in the past with other themes easily but my usual code below is not working, it is in functions.php of a child theme. Any suggestions as to how to get this working please? (Currently on local dev site so no url)

    //***** Login stuff
    if( is_user_logged_in() ) { 
    	$args['menu'] = 'logged-in';
    } else { 
    	$args['menu'] = 'logged-out';
    } 
    	return $args;
    }
    add_filter( 'wp_nav_menu_args', 'my_wp_nav_menu_args' );
Viewing 1 replies (of 1 total)
  • Theme Author ThemeZee

    (@themezee)

    Hi there,

    Thanks so much for using Poseidon.

    The theme supports multiple menus and assigns custom menus with menu locations, so I guess that is the reason the code does not work. I do not see any code which targets a menu specifically.

    I don’t know the wp_nav_menu_args filter in particular, so you have to check the documentation how you have to adjust your code.

    However, I can recommend a plugin to solve that kind of thing: https://www.ads-software.com/plugins/user-menus/ It is my go-to solution.

    Cheers,
    Thomas

Viewing 1 replies (of 1 total)
  • The topic ‘logged in / logged out different menu’ is closed to new replies.