wordpress custom menu function code example

Example 1: wp_nav_menu

wp_nav_menu( array(
    'menu' => 'TEST',
    'menu_class' => "", 
    'menu_id'   => "",
    'container' => false
) );

Example 2: how make custom menu in wordpress

function wpb_custom_new_menu() {
  register_nav_menus(
    array(
      'my-custom-menu' => __( 'My Custom Menu' ),
      'extra-menu' => __( 'Extra Menu' )
    )
  );
}
add_action( 'init', 'wpb_custom_new_menu' );

Example 3: how make custom menu in wordpress

<?php
wp_nav_menu( array( 
    'theme_location' => 'my-custom-menu', 
    'container_class' => 'custom-menu-class' ) ); 
?>

Example 4: wp main menu

wp_nav_menu( array( 'theme_location' => 'header', 'menu' => 'Main Menu') );

Tags:

Misc Example