WordPress.org

Ready to get started?Download WordPress

Forums

Nav Bar Menu Isses (9 posts)

  1. davidz.stein
    Member
    Posted 3 years 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?

  2. forunner
    Member
    Posted 3 years 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?

  3. davidz.stein
    Member
    Posted 3 years ago #

    Is there no way to get rid of their ul and keep mine?

  4. w4rdy
    Member
    Posted 3 years ago #

    Yes you should be able to remove it in the wp-includes/nav-menu-template.php file

  5. davidz.stein
    Member
    Posted 3 years ago #

    where exactly there do I remove it in that file?

  6. w4rdy
    Member
    Posted 3 years ago #

    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

  7. '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 3 years ago #

    Will this take anything else away?

  • davidz.stein
    Member
    Posted 3 years ago #

    Did not work, any other guesses out there?

  • TakeoK
    Member
    Posted 3 years ago #

    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.

  • Topic Closed

    This topic has been closed to new replies.

    About this Topic

    Tags