image

How to Call Custom Menu in Wordpress Put Below Code in function.php File

if ( function_exists( 'register_nav_menus' ) ) {
        register_nav_menus(
               array(
                 'main_menu' => __( 'Main Menu', 'cake' ),
                 'secondary_menu' => __( 'Secondary Menu', 'cake' ),
               )
        );
}
 

  After this save your Function.php file and Put Below code in Header.php file  

<?php if ( has_nav_menu( 'main_menu' ) ) { ?>
        <?php $defaults = array(
          'theme_location'  => 'main_menu',
          'menu'            => '', 
          'container'       => false, 
          'echo'            => true,
          'fallback_cb'     => false,
          'items_wrap'      => '<ul id="%1$s"> %3$s</ul>',
          'depth'           => 0 );
          wp_nav_menu( $defaults );
        ?>
<?php } else { ?>
        <ul>
          <?php wp_list_pages('title_li='); ?>
        </ul>
<?php } ?>
 

  This Code Display Your Menu in Site.