I looked around and couldn't get any answer that helped me.
I have an include that I am calling in multiple headers (I have different headers for different sections of a membership site that need different menus and resources.)
template-main-nav.php:
<div id="nav">
<div class="close-menu"></div>
<?php
wp_nav_menu(
array(
'menu' => $menu_name,
'theme_location' => 'primary',
'depth' => 1,
'menu_class' => 'main-menu',
'menu_id' => 'main-menu'
)
); ?>
<div class="header-tools">
<div class="icon-list">
<a href="/help" class="icon help trigger-help" title="help"></a>
<a href="/dashboard" class="icon account" title="my account"></a>
</div>
</div>
</div>
and above the header in each header-x.php file I am declaring the $menu_name variable:
<?php
$menu_name = 'Section 1 Menu';
get_template_part('template-main-nav');
?>
I want multiple different menus I've created in the admin to go into the same location and this seemed like the best solution. The thing is I can't get the variable to pass, no matter how I format it. What am I doing wrong?