I have tried several options like setting 'container' => false
and registering the theme_location and searching on forums but I am unable to get rid of the “div” coming with the wp_nav_menu
in my page:
<?php get_nav_menu();?>
function get_nav_menu() {
$navMenuDefaults = array(
'theme_location' => 'header-nav',
'menu' => '',
'container' => false,
'container_class' => '',
'container_id' => '',
'menu_class' => '',
'menu_id' => '',
'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' => ''
);
return wp_nav_menu($navMenuDefaults);
}
and in functions.php:
function register_top_nav() {
register_nav_menu('header-nav',__( 'Header Nav' ));
}
add_action( 'init', 'register_top_nav' );
I am not sure why I am getting the following output:
<div class="">
<ul>
<li class="page_item page-item-2">
<a href="https://wordpress.stackexchange.com/questions/202502/url">Sample Page</a>
</li>
</ul>
</div>
How can I get something like following:
<ul class="abc">
<li>
<a href="#">dfdf</a>
</li>
</ul>
thanks.