I’m trying to create a custom menu for wordpress, and I’m having a few problems.
I have 3 other menu’s that work perfectly using this code:
add_action( 'init', 'register_my_menus' );
function register_my_menus() {
register_nav_menus(
array(
'primary-menu' => __( 'Primary Menu' ),
'top-menu' => __( 'Top Menu' ),
'footer-menu' => __( 'Footer Menu' ),
'baseball-menu' => __( 'Baseball Menu' ),
)
);
}
However the problem is that even when I add the menu in the admin panel, the wrong menu shows up when I call for this -Baseball menu- on a custom page.
This is the code I used to call the Baseball menu, however when I check the page, what shows up is the normal Navigation menu.
I’m running out of ideas. What could be causing this problem?
<?php
/* Template Name: Baseball Page */
get_header(); ?>
<!-- BEGIN MAIN WRAPPER -->
<div id="main-wrapper">
<div>
<?php wp_nav_menu( array( 'container' => false, 'theme-location' => 'baseball-menu' ) ); ?>
</div>
</div>
<?php get_footer(); ?>
It looks like the issue is with the ‘theme-location’. It is using a dash instead of an underscore.
It should be ‘theme_location’.
Hope that helps,
~ crw