davidz.stein
Member
Posted 1 year ago #
I am trying to get my nav menu to work but the menu_id is creating a ul thats blocking it form working.
<?php wp_nav_menu( array('menu' => 'Main', 'container' => '' , 'menu_class' => 'Main', 'menu_id' =>'' )); ?>
How do I get rid of or override that menu_id?
forunner
Member
Posted 1 year ago #
the menu create a ul because it is mandatory to contain "li"
maybe [MAYBE] your menu could works if you delete your own ul, and put the menu_id instead your ul inside your css?
davidz.stein
Member
Posted 1 year ago #
Is there no way to get rid of their ul and keep mine?
Yes you should be able to remove it in the wp-includes/nav-menu-template.php file
davidz.stein
Member
Posted 1 year ago #
where exactly there do I remove it in that file?
I'd take out the following code and see what happens... back it up first though.
$nav_menu .= '<ul'. $attributes .'>';
// Allow plugins to hook into the menu to add their own
's
$items = apply_filters( 'wp_nav_menu_items', $items, $args );
$items = apply_filters( "wp_nav_menu_{$menu->slug}_items", $items, $args );
$nav_menu .= $items;
unset($items);
$nav_menu .= '';
=======================================================================
function start_lvl(&$output, $depth) {
$indent = str_repeat("\t", $depth);
$output .= "\n$indent<ul class=\"sub-menu\">\n";
}
/**
* @see Walker::end_lvl()
* @since 3.0.0
*
* @param string $output Passed by reference. Used to append additional content.
* @param int $depth Depth of page. Used for padding.
*/
function end_lvl(&$output, $depth) {
$indent = str_repeat("\t", $depth);
$output .= "$indent\n";
}
davidz.stein
Member
Posted 1 year ago #
Will this take anything else away?
davidz.stein
Member
Posted 1 year ago #
Did not work, any other guesses out there?
Has anyone figured out how to remove the<ul> when using wp_nav_menu(). I really need to remove the <ul> (and add my own in the template) in order for my theme to work properly.