Reputation: 440
I currently have two different custom menus. I want the first menu "Main" to be displayed at the top of the page as the top navigation. I want the second menu "Slider" under the slider.
I have this at the top:
<?php wp_nav_menu(array('theme_location' => '','container' => '',));?>
And somehow it's picking up the links in the first menu "Main" and showing it on top. Now I want to display the links from the 2nd menu under the slider
<?php register_nav_menu( 'Slider', 'Under Slider Navigation' ); ?>
<?php wp_nav_menu(array('theme_location' => 'Slider','container' => '',));?>
And with this, it is showing every single page I Have in the nav bar. Please help.
Upvotes: 0
Views: 23939
Reputation: 3358
try the below function
function register_my_menus() {
register_nav_menus(
array(
'Slider' => __( 'Under Slider Navigation' ),
)
);
}
add_action( 'init', 'register_my_menus' );
<?php wp_nav_menu( array( 'theme_location' => 'Slider' ) ); ?>
register_nav_menus
must be in array
Upvotes: 1
Reputation: 1457
Initialise the menu before you register it. Also, ideally this should go into functions.php
<?php function my_second_nav(){
wp_nav_menu(array('theme_location' => 'Slider','container' => '',))}
register_nav_menu( 'Slider', 'Under Slider Navigation' ); ?>
Then position it wherever you want
<?php my_second_nav(); ?>
Upvotes: 0