0

How can i fix the navigation menu links in Wordpress,

I want to generate the menu in following format without using class or id references in child items.

<ul >
            <li><a href="index.php">Home 01</a>
                    <div>
                        <ul>
                        <li><a href="#">Sub Menu A</a>
                        <li><a href="#">Sub Menu B</a>
                      </ul>
                    </div>
            </li>

            <li><a href="#">Menu 02</a>
                    <div>
                        <ul>
                        <li><a href="#">Sub Menu A</a>
                        <li><a href="#">Sub Menu B</a>
                      </ul>
                    </div>
            </li>

</ul>

This is a Custom Menu and iam using widget to call it.

register_sidebar( array(
        'name' => __( 'Top Menus', 'my_custom_one' ),
        'id' => 'menu-widget-area-top',
        'description' => __( 'Top Menus', 'my_custom_one' ),
        'before_widget' => '',
        'after_widget' => '',
        'before_title' => '',
        'after_title' => '',
    ) );

and I have used this PHP code in my template

$menu = 'menu-widget-area-top';
$defaults = array(
    'theme_location'  => '',
    'menu'            => '',
    'container'       => true, 
    'container_class' => ''.$menu.'', 
    'container_id'    => '',
    'menu_class'      => '', 
    'menu_id'         => '',
    'echo'            => 0,
    'fallback_cb'     => false,
    'before'          => '',
    'after'           => '',
    'link_before'     => '',
    'link_after'      => '',
    'items_wrap'      => '',
    //'items_wrap'      => '<ul id="%1$s" class="%2$s">%3$s</ul>',
    'depth'           => 0,
    'walker'          => ''
);
echo wp_nav_menu( $defaults );
4

0 回答 0