How to Create Menu in Wordpress

As well all know that user cannot access our pages till they cannot have its link. So pages or any category in blog can be displayed in menu. In WordPress you can make menu dynamic and you can add any pages or category of blog in menu.

To Create Menu in WordPress :-
1. Login with WordPress admin Panel.
2. Click on Appearance -> Menu.


3. Enter Name and Click on Create New Button.

After click on Create Menu You can see left hand sidebar is active.


You can check multiple pages with checkbox and click on "Add to Menu" Button. If you not seen any of your pages then click on "View All" Tab.

You can also Add static menu and its link if you not want to make page for it. If in your menu bar a menu is linked to another site, so you cannot create page for it, so you can create link for it. Enter Menu Name and URL and click "Add to Menu" Button.

You can also show Blog Category in your Menus. Select any Category and Click on "Add to Menu" button.


After Adding you can see in Right hand side you can view all the menu that is added and you can ordered menu by drag and drop and also you can make sub menu to just drag the menu to right.

Theme Locations:

In your website there are many type of menu you have like Left Menu, Right Menu, Header, Footer etc..

Then you can create any number of menus for your site and where this menu displayed you can set the location of menu by checking "Theme Location Section".

In WordPress by default you get only one menu. To Create more menu location you want to place this code in your Function.php file (Located at wp-content->themes->your current theme->function.php)

Find this function "function twentyfourteen_setup() {"
and then find

register_nav_menus ( array (
'primary' => __ ( 'Top primary menu', 'twentyfourteen' ),
'secondary' => __ ( 'Secondary menu in left sidebar', 'twentyfourteen' ) 
) );

then you can copy this line

'secondary' => __ ( 'Secondary menu in left sidebar', 'twentyfourteen' ) 

and you can paste it in same array :

register_nav_menus ( array (
'primary' => __ ( 'Top primary menu', 'twentyfourteen' ),
'secondary' => __ ( 'Secondary menu in left sidebar', 'twentyfourteen' ) ,
                                'third' => __ ( 'Footer Menu', 'twentyfourteen' ) 
) );

Follow the above type you can make many types of menu to display different different places in your website location.

By Default Primary menu is shows in header part of website, but to display the "third" menu you can use this function

<?php wp_nav_menu( array( 'theme_location' => 'third', 'menu_class' => 'nav-menu' ) ); ?>

WordPress uses above function to display menus so if you want to show another menu just pass the name in "theme_location" argument.

Comments