If I set 'echo' parameters value to 'true':
<?php if( has_nav_menu( 'primary-menu' ) ) {
wp_nav_menu( $menuParameters = array(
'theme_location' => 'primary-menu',
'container' => '',
'container_class' => false,
'container_id' => false,
'menu' => 'Primary',
'menu_id' => 'test',
'menu_class' => 'nav navbar-nav navbar-right',
'echo' => true,
'fallback_cb' => 'wp_page_menu',
'before' => '',
'after' => '',
'link_before' => '',
'link_after' => '',
'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s</ul>',
'depth' => 0,
'walker' => ''
) );
wp_nav_menu (array('theme_location' => 'primary-menu'));
} ?>
I get an output of:
<ul id="test" class="nav navbar-nav navbar-right">
<li class="current-menu-item"><a href="http://localhost/test/">Home</a></li>
<li><a href="http://localhost/test/contact/">Contact</a></li>
</ul>
<ul id="menu-primary" class="menu">
<li class="current-menu-item"><a href="http://localhost/test/">Home</a></li>
<li><a href="http://localhost/test/contact/">Contact</a></li>
</ul>
The first one is the desired result and the last one is WP default output which is a pain. Any ideas on how to get rid of it by altering my array?