One thing wp_nav_menu should be able to remove (3 posts)

  1. heyarny
    Posted 5 years ago #

    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 .= '<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.

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

  3. sammyb
    Posted 5 years ago #

    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.


    $sub_menu = wp_nav_menu(array( 'echo' => '0'));
    $rep[1]='/<ul (.*?)>/i';
    echo preg_replace($rep,$repl,$sub_menu);

Topic Closed

This topic has been closed to new replies.

About this Topic