0

How do I use the menu on the dashboard under Appearance > Menu - http://prntscr.com/5052sl

The one I'm using is based on page arrangement, so all my pages are displayed on the menu under some pages.

wp_nav_menu( array( 
    'sort_column'    => 'menu_order', 
    'container'      => false,
    'theme_location' => 'header-menu', 
    'exclude'        => '479' 
) );

I want to use the menu on the Appearance tab, but I don't know how to call my menu.

0

If you check the codex documentation page about the wp_nav_menu you will see that there is a param called menu, and that will allow you to target a specific menu.

As pointed on the documentation you can check this:

wp_nav_menu(
    // Use this menu
    'menu' => 'Project Nav',

    // do not fall back to first non-empty menu
    'theme_location' => '__no_such_location'

    // do not fall back to wp_page_menu()
    'fallback_cb' => false
);

But if you want to register a place I mean theme_location, you need to register_nav_menu then a new Widget will appear on the Appearance tab and you will be able to select which menu goes to that location registered.


You just need to place this on your theme functions.php and head over to the "Appearance" > "Menu" on the Wordpress Admin and select the menu you want to be assigned to the Primary Menu.

add_action( 'after_setup_theme', 'q166543_register_menu' );
function q166543_register_menu() {
    register_nav_menu( 'primary', 'Primary Menu' );
}

Then head over to the place you want to display the menu and paste the following code:

wp_nav_menu(
    'container'      => false,
    'theme_location' => 'primary',
    'exclude'        => '479',


    // do not fall back to wp_page_menu()
    'fallback_cb' => false
);
5
  • can you guide me in laymans I don't know much about php and it's very hard for me to understand that.
    – MIke
    Oct 27 '14 at 4:53
  • Hi @MichaelPon I've edited my answer now it has a guide to solve the problem.
    – Bordoni
    Oct 27 '14 at 4:59
  • I have now added my custom menu from the widget area. thanks i forgot to look at my widget tab.
    – MIke
    Oct 27 '14 at 5:00
  • does this only adds an extra widget area? I'm thinking about the menu name do i have to match anything on my files with the ones you posted?
    – MIke
    Oct 27 '14 at 5:10
  • I didn't understand what you said.
    – Bordoni
    Oct 27 '14 at 5:23

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.