I'm working on a wordpress site and I got the following problem:
To have a different menu for those who are logged in, I use the following code:
function my_wp_nav_menu_args( $args = '' ) {
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' );
In the footer, there's another menu, but due to the code above, it gets changed to the logged-in or logged-out menu.
I made 2 other menu's, called bottom-logged-in
and bottom-logged-out
, and I want to use the same code to change the menu in the footer to those 2 menus.
I'm using visual composer and added the class vertical-menu-custom
to the menu used for the footer.
Edit: I thought maybe it is possible to write another if/else statement to check if the menu is in the vertical-menu-custom
div, and then use the current code 2 times: 1 for the menu that isn't inside the vertical-menu-custom
, and 1 for the menu which is. And then of course change menu names to the menu's for the footer.