Reputation: 43
I have created two custom menus on my wordpress site.
Both menus setup in Appearance -> Menus. However both menus display the same set of pages which was all at the time of creation and cannot be changed despite creating two separate menus and assigning this to the locations set.
Declared in function.php
function register_my_menus() {
register_nav_menus(
array(
'main-menu' => __( 'Main Menu' ),
'extra-menu' => __( 'Store Menu' )
)
);
}
add_action( 'init', 'register_my_menus' );
Set theme location.
<?php wp_nav_menu( array( 'theme_location' => 'Main Menu', 'container_class' 'menu_class' ) ); ?>
<?php wp_nav_menu( array( 'theme_location' => 'Store Menu', 'container_class' => 'storeMenu_class' ) ); ?>
Upvotes: 4
Views: 2712
Reputation: 279
Try Below Code.
You have to use main-menu
& extra-menu
as "theme_location"
<?php wp_nav_menu( array( 'theme_location' => 'main-menu', 'container_class'=> 'menu_class' ) ); ?>
<?php wp_nav_menu( array( 'theme_location' => 'extra-menu', 'container_class' => 'storeMenu_class' ) ); ?>
Upvotes: 4