How to use register_nav_menus in WordPress?

I’m creating a custom wordpress design with the help of an instruction book and got stuck with the menu creation.

I should input the following code in functions.php

Read More
register_nav_menus( array(
        'fomenu'   => __( 'Fomenu', 'smaragdkerteszet' ),
        'kismenu'  => __( 'Kismenu', 'smaragdkerteszet' ),
) );

After that I should be able to go to Appearance/menus in the admin panel and choose between the 2 menus in a drop-down list but this list does not appear.

What do I need to fix?

Related posts

2 comments

  1. Just follow this code:

    function register_all_menu(){
        register_nav_menus(
          array('top_menu' => 'Top Menu')
          );
     }
    

    And add “show_top_menu” in the place that you want to display nav menu.

    Function show_top_menu(){
        $topMenu = array(
           'theme_location' => 'top_menu',
           'container' =>'false',
           'item_wraper' => '<ul id ="top_menu" class="%2$s">3$s</ul>'  
           );
    wp_nav_menu($topMenu);
    }
    
  2. Maybe an add_action can help:

    // Register your menus
    function my_custom_menus() {
        $locations = array(
            'fomenu'   => __( 'Fomenu', 'smaragdkerteszet' ),
            'kismenu'  => __( 'Kismenu', 'smaragdkerteszet' ),
        );
        register_nav_menus( $locations );
     }
    
    // Hook them into the theme-'init' action
    add_action( 'init', 'my_custom_menus' );
    

Comments are closed.