How to have multiple WordPress Menus

There are a few steps you need to take to add menus, the wordpress way.

  1. Register the menu in functions.php using register_nav_menus()

Codex Link: https://codex.wordpress.org/Function_Reference/register_nav_menus

Example:

register_nav_menus( array(
    'my_custom_menu' => 'My Custom menu',
    'my_other_menu' => 'My Other Menu',
) );

Now you can create new menus on the back-end

Login and go to Appearance -> Menus

Add a new menu name, menu items, and then check the box that displays the corresponding menu name you registered.

Now, that the menu has been registered and created in the back-end, you can use the function wp_nav_menu() to display it in the front-end.

Codex Link: https://codex.wordpress.org/Function_Reference/wp_nav_menu

Example: You would put this in header.php or a file where you want the menu to be displayed.

    $defaults = array(
        'theme_location'  => '',
        'menu'            => 'my_custom_menu',
        'container'       => 'div',
        'container_class' => '',
        'container_id'    => '',
        'menu_class'      => 'menu',
        'menu_id'         => '',
        'echo'            => true,
        'fallback_cb'     => 'wp_page_menu',
        'before'          => '',
        'after'           => '',
        'link_before'     => '',
        'link_after'      => '',
        'items_wrap'      => '<ul id="%1$s" class="%2$s">%3$s</ul>',
        'depth'           => 0,
        'walker'          => ''
    );

    wp_nav_menu( $defaults );

These are examples only. Please consult the links to see all available options. You can also create menus using other functions such as wp_list_pages or wp_list_categories, depending on what you need.

deneme bonusu veren sitelerbahis casinomakrobetceltabetpinbahispolobetpolobet girişpinbahis girişmakrobet girişpulibet girişmobilbahis girişkolaybet giriş