Hide/Show menus when logged in/out
-
When clients logged in, I want that they see an other menu than logged out. A logged in menu like this: logout – my listings – add a listing. An when they are logged out, they only see a logged out menu like: login or create a listing
I have made a snippet:
function my_wp_nav_menu_args( $args = ” ) {
if( $args[‘theme_location’] == ‘primary’ ){
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’ );This works! But it doesn’t work as responsive. I have made a template with Generate Press. How can I make it works also responsive.
Or do anyone know an other sollution?
Thank you on forehand!
- The topic ‘Hide/Show menus when logged in/out’ is closed to new replies.