Home › Forums › Support › Can we display the menus conditionally? This topic has 6 replies, 3 voices, and was last updated 8 years, 2 months ago by Tom. Viewing 7 posts - 1 through 7 (of 7 total) Author Posts August 31, 2015 at 10:45 pm #133418 Pete How would we dig into the code to put a conditional thing around the menus? August 31, 2015 at 11:07 pm #133425 TomLead Developer Lead Developer This plugin may be helpful: https://wordpress.org/plugins/if-menu/ Never used it before, but it looks promising. September 1, 2015 at 5:19 am #133458 Pete Not the menu items, but the whole menu itself! Whooa! September 1, 2015 at 9:39 am #133517 TomLead Developer Lead Developer This one does the whole menu: https://wordpress.org/plugins/menu-swapper/ September 1, 2015 at 10:04 am #133523 bdbrown Here’s a way to hide the main menu if the user isn’t logged on: 1. In your child theme create a new file like “my-styles.css” 2. Add this css to that file: nav.main-navigation { display: none; } 3. Add this function to your child theme functions.php file: add_action( 'wp_enqueue_scripts', 'enqueue_my_styles'); function enqueue_my_styles() { if ( !is_user_logged_in() ) { wp_enqueue_style( 'my-style', get_stylesheet_directory_uri().'/my-styles.css' ); } } January 30, 2016 at 7:24 pm #169141 Pete Thanks! January 30, 2016 at 11:55 pm #169183 TomLead Developer Lead Developer No problem, glad I could help 🙂 Author Posts Viewing 7 posts - 1 through 7 (of 7 total) You must be logged in to reply to this topic. Log In Username: Password: Keep me signed in Log In