Is it possible to change to a different menu using conditional tags but using the same theme location?
I have 2 menu's created which I want to display conditionally in the same them location which is the secondary menu location.
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It only takes a minute to sign up.
Sign up to join this communityYes, You can easily switch menus using conditional tags.
For example If you want to show different menu for logged in user and non-logged in user then It may be like:
<?php
if ( is_user_logged_in() ) {
wp_nav_menu( array( 'theme_location' => 'logged-in-menu' ) );
} else {
wp_nav_menu( array( 'theme_location' => 'logged-out-menu' ) );
}
?>