phprockers-logo

How to register the menu in "Theme Location"?

In wordpress, very easy to register the menu in "Theme Location". For that so you have to follow some steps.

Step 1: Goto localhost/WORDPRESS FOLDER/wp_content/themes/twentyeleven/

Step 2: Open functions.php file.

Step 3: "register_nav_menu( 'primary', __( 'Primary Menu', 'twentyeleven' ) );" find this inside the file. After find the code, below you have to write a  following code.
Step 4: Code for create a register menu,
register_nav_menu( 'yourmenu', __( 'YOUR MENU NAME', 'twentyeleven' ) );


Step 5: Code for create an array of register menu,
            register_nav_menus( array(
                      'menu1' => 'YOUR MENU NAME',
                      'menu2' => 'YOUR MENU NAME',
                      'menu3' => 'YOUR MENU NAME',
                      'menu4' => 'YOUR MENU NAME',
                      'menu5' => 'YOUR MENU NAME'
             ));

Step 6: After save this in function.php, then goto "http://localhost/WORDPRESS FOLDER NAME/wp-admin/nav-menus.php".

Step 7: Our register menu name should be appeared here. Then you have to assign the menu here.

0 comments:

Post a Comment