How to Add Custom WordPress Menu

To add a custom navigation menu, the first thing you need to do is register your new navigation menu by adding this code to your theme’s functions.php file.

function hd_custom_new_menu() {
      'my-custom-menu' => __( 'Menu 1' ),
      'my-custom-menu-1' => __( 'Menu 2' )
add_action( 'init', 'hd_custom_new_menu' );

You will need to add this code in your theme’s template file where you want to display your menu.

//for menu 1
wp_nav_menu( array( 
    'theme_location' => 'my-custom-menu', 
    'container_class' => 'your-custom-class' ) ); 

//for menu 2
wp_nav_menu( array( 
    'theme_location' => 'my-custom-menu-2', 
    'container_class' => 'your-custom-class' ) ); 

Its done.

Leave a Reply

Your email address will not be published.

You may use these <abbr title="HyperText Markup Language">html</abbr> tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>


%d bloggers like this: