Nathan
Nathan

Reputation: 1762

WordPress Custom Menu in header.php

I'm creating a custom WP theme and trying to add custom menus to the header. I've been able to get custom menus to work in page templates but not in header.php. I'm using register_nav_menus in functions.php and setting them up from the WordPress GUI. When I add a menu to my header via wp_nav_menu, I always get the same default menu. Is this a glitch? Am I doing something wrong?

Here's my functions.php code:

function bt_register_custom_menus() {
  register_nav_menus(array('header_left' => __('Header Left'), 'header_right' => __('Header Right')));
}
add_action('init', 'bt_register_custom_menus');

Here's my header.php code:

<?php wp_nav_menu( array('theme-location' => 'header_left' )); ?>
<?php wp_nav_menu( array('theme-location' => 'header_right' )); ?>

Upvotes: 0

Views: 10598

Answers (1)

scibuff
scibuff

Reputation: 13765

Is it theme_location not theme-location

Upvotes: 1

Related Questions