I am currently working on my own theme. In this theme I want two menus topmenu
and bottommenu
.
In the functions.php file I have the following code:
// This adds the support to add a thumbnail and custom menus
function thumbnail_menu_support() {
add_theme_support( 'post-thumbnails' );
register_nav_menus(
array(
'topmenu' => __( 'Top menu' ),
'bottommenu' => __( 'Bottom menu' )
)
);
}
add_action( 'init', 'thumbnail_menu_support' );
In my header.php and in the footer.php I have the following code:
<?php wp_nav_menu( array(
'menu' => 'Top menu',
'menu_id' => 'topmenu',
'container' => false,
'fallback_cb' => false,
'theme-location' => 'topmenu'
) ); ?>
and
wp_nav_menu( array(
'menu' => 'Bottom menu',
'menu_id' => 'bottommenu',
'container' => false,
'fallback_cb' => false,
'theme-location' => 'bottommenu'
) );
Now, when I make a menu in the backend of Wordpress, and specify that it should only be in the top menu, it will be rendered in both menus.