I have added my secondary menu on my function.php file and WordPress also allowed me to choose the secondary menu. The problem is both menu bar appeared at the same time so i have double menu bar on the top of my home page and also my about us page. What I'm try to do is show my primary menu bar only in my main home page, and show secondary menu on my about us page, services page, etc... How can i fix it?
function.php file
register_nav_menus( array(
'primary' => esc_html__( 'Primary', 'themename' ),
'secondary' => __( 'Secondary Menu', 'themename' ),
) );
Header.php file
<?php if ( has_nav_menu( 'primary' )
'theme_location' => 'secondary',
'container' => 'nav',
'container_class' => 'navbar navbar-default',
'menu_class' => 'nav navbar-nav navbar-right'
; ?>
<?php
if ( has_nav_menu( 'secondary_navigation_menu' ) ) {
wp_nav_menu( array( 'theme_location' => 'secondary_navigation_menu' ) );
} ?>
<?php if ( is_home() ): ?>
<?php if ( has_nav_menu( 'primary' ) : ?>
//primary menu
<?php endif; ?>
<?php endif; ?>
P.S. Both of my menu bar are different CSS.
Your help will be appreciated!