Support » Requests and Feedback » One thing wp_nav_menu should be able to remove

  • Now as 3.0 gives us more abilities to customize navigation menus using wp_nav_menu and Walker_Nav_Menu, there is one thing left:

    nav-menu-template.php:219
    $nav_menu .= '<ul'. $attributes .'>';

    We are still forced to use <ul> ?
    I don’t see a way to remove <ul> for specific navigation menus.

    If I’m mistaken here, please give me an advise.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    Lead Plugin Wrangler

    You can style uls with CSS, but yes, we still use ul. That’s good HTML.

    ul is obviously ‘good html’, but what if you don’t want it?

    you could always set the ‘echo’ parameter to false and then use preg_replace to remove the ul / li tags.

    example:

    $sub_menu = wp_nav_menu(array( 'echo' => '0'));
    $rep[1]='/<ul (.*?)>/i';
    $rep[2]='/<\/ul>/';
    $repl[1]='';
    $repl[2]='';
    echo preg_replace($rep,$repl,$sub_menu);
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘One thing wp_nav_menu should be able to remove’ is closed to new replies.