Comments Onyx started the conversationJuly 17, 2016 at 8:24pmWe want to change the top menu after login such that the menu title changes to Hello, "username" and the dropdown of the top menu should also change. However when we implement this code " function my_wp_nav_menu_args( $args = '' ) { if( is_user_logged_in() ) { $args['menu'] = 'logged-in'; } else { $args['menu'] = 'topleft'; } return $args; } add_filter( 'wp_nav_menu_args', 'my_wp_nav_menu_args' ); " it also changes the brand/primary menu. Please get back to us ASAP. Thankyou :) [deleted] repliedJuly 19, 2016 at 1:54pmHi Onyx,The code you have added will be applied for all menus, however you can add the same code it this way (modified slightly): function my_wp_nav_menu_args( $args = '' ) { if ( is_admin() ) { return $args; } if( is_user_logged_in() ) { $args['menu'] = 'logged-in'; } else { $args['menu'] = 'topleft'; } remove_filter( 'wp_nav_menu_args', 'my_wp_nav_menu_args' ); return $args; } add_filter( 'wp_nav_menu_args', 'my_wp_nav_menu_args' ); Hopefully this will work for you. Sign in to reply ...
We want to change the top menu after login such that the menu title changes to Hello, "username" and the dropdown of the top menu should also change. However when we implement this code "
function my_wp_nav_menu_args( $args = '' ) {
if( is_user_logged_in() ) {
$args['menu'] = 'logged-in';
} else { $args['menu'] = 'topleft';
}
return $args;
}
add_filter( 'wp_nav_menu_args', 'my_wp_nav_menu_args' );
" it also changes the brand/primary menu. Please get back to us ASAP. Thankyou :)
Hi Onyx,
The code you have added will be applied for all menus, however you can add the same code it this way (modified slightly):
Hopefully this will work for you.