0

If possible, could someone answer this in very easy steps as I am new to coding.

I was wandering if there is an easy method for having multiple menus in any theme; I have been searching the internet for weeks, to no avail.

I would like to have three main menus - excluding the footer

How would I go about doing this? Would there be a way to integrate multisite functionality? Feel free to ask any more questions.

  • 1
    Is there anything you need other than the answer that have provided below? – 5ervant Aug 4 '15 at 17:57
1

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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.