How Do I Create a Menu and Submenu Admin in WordPress?

Creating a menu and submenu admin in WordPress is an easy task if you follow the following steps:

1. Create a new file in your WordPress admin area called menu.

php.

2. Add the following code to the newly created menu.php file:

array(

‘heading’ => __( ‘Primary Menu’, ‘WordPress’ ),

‘items’ => array(

‘nav_item’ => array(

‘heading’ => ‘Primary Navigation’,

‘url’ => ‘/’

),

‘dropdown_item’ => array(

‘heading’ => ‘Primary Menu Dropdowns’,

‘url’ => ‘/dropdown’

‘menu_link’ => array(

‘heading’ => ‘Primary Menu Links’,

‘url’ => ‘/links’

‘primary_submenu_item’ => array(

‘heading’ => ‘Primary Submenu Items’,

‘url’ => ‘/submenu’

)

‘submenu’ => array(

‘heading’ => ‘Submenu’,

‘heading’ => ‘Secondary Navigation’,

‘url’ => ‘/subnavigation’

‘heading’ => ‘Submenu Links’,

‘url’ => ‘/links-submenu’

‘submenu_item’ => array(

‘heading’ => ‘Submenu Items’,

‘url’ => ‘/submenu-items’

‘children’ => array(

‘heading’ => ‘Children’,

‘url’ => ‘/children’

‘heading’ => ‘Children Dropdowns’,

‘url’ => ‘/dropdown-children’

‘heading’ => ‘Children Links’,

‘url’ => ‘/links-children’

‘heading’ => ‘Children Items’,

‘url’ => ‘/submenu-children’

);

wp_set_option( ‘theme_location’, WPLD_MENU_PATH . ‘/includes’ );

}

?>

3. Add the following code to the footer of your WordPress admin area:

/*

wp_enqueue_script( ‘wp-menu’, ‘1.0’ );

4. Activate the menu in the WordPress admin area by clicking on the “wp_menu” menu item.

5. Add a menu item to your primary menu by clicking on the “add a new menu item” button.

6. Enter the following code in the new menu item’s text field:

  • Subnavigation
  • 10. Click on the “add” button to add the submenu item to your secondary menu.

    11. Activate the menu items in your primary and secondary menus by clicking on the “activate” buttons.

    12. Add a menu item to your children menu by clicking on the “add a new menu item” button.

    13. Enter the following code in the.