Second Navigation showing on all pages but should only show on home page
-
Hello, I am new to php but trying my hardest to figure things out. I created a second navigation that I want to show up only on the home page. It should display just Brides & Grooms, and the other pages should use a different menu displaying only home. I am using the Azure theme and already registered my other nav in themes.php.
This is what I have in themes.php:
// This theme uses wp_nav_menu() in one location.
register_nav_menu( ‘primary’, __( ‘Primary Menu’, ‘azurebasic’ ) );//register the custom menus
function register_my_menus() {
register_nav_menus(
array(
‘top-nav’ => __( ‘Top Nav’ )
)
);
}
add_action( ‘init’, ‘register_my_menus’ );This is what I have in header.php:
<nav id=”access” role=”navigation” class=”clearfix”>
<?php if (is_front_page()) {
wp_nav_menu( array(‘menu’ => ‘top-nav’ ));
} else {
wp_nav_menu( array(‘menu’ => ‘primary’ ));
}
?></nav><!– #access –>
The top-nav is showing on every page but should only show on the home page. The primary navigation should show on all the other pages.
Please help! Thank you!
- The topic ‘Second Navigation showing on all pages but should only show on home page’ is closed to new replies.