How to show secondary menu to looged in users only
-
Hi, I have a quick question on primary/ secondary menu in wordpress. I have just enable the secondary menu in functions.php and now I would like the secondary menu to only show for logged in users and primary to all.
I know I have to change the header.php file a bit, but I am not sure how – here is the excerpt of my header.php with the respective menu codes:<div id="top-navigation"> <nav> <?php $menuClass = 'nav'; if ( 'on' == et_get_option( 'explorable_disable_toptier' ) ) $menuClass .= ' et_disable_top_tier'; $primaryNav = ''; if ( function_exists( 'wp_nav_menu' ) ) { $primaryNav = wp_nav_menu( array( 'theme_location' => 'primary-menu', 'container' => '', 'fallback_cb' => '', 'menu_class' => $menuClass, 'echo' => false ) ); } if ( '' == $primaryNav ) { ?> <ul class="<?php echo esc_attr( $menuClass ); ?>"> <?php if ( 'on' == et_get_option( 'explorable_home_link' ) ) { ?> <li <?php if ( is_home() ) echo( 'class="current_page_item"' ); ?>><a href="<?php echo esc_url( home_url( '/' ) ); ?>"><?php esc_html_e( 'Home','Explorable' ); ?></a></li> <?php }; ?> <?php show_page_menu( $menuClass, false, false ); ?> <?php show_categories_menu( $menuClass, false ); ?> </ul> <?php } else echo( $primaryNav ); ?> </nav> <div class="et-search-form"> <form method="get" class="searchform" action="<?php echo esc_url( home_url( '/' ) ); ?>"> <input type="text" value="<?php esc_html_e( 'Search this site...', 'Explorable' ); ?>" name="s" class="search_input" /> <input type="image" src="<?php echo $template_directory_uri; ?>/images/search-icon.png" class="search_submit" /> </form> </div> <!-- .et-search-form --> </div> <!-- #top-navigation -->
Appreciate if someone can quickly help.
Cheers,
Dirk
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘How to show secondary menu to looged in users only’ is closed to new replies.