Create dynamic menu in Wordpress manage with admin panel

 So first go to admin and check appearance section and there is no menu location so we have to set that from functions.php.

so go to functions.php and find university_feature function and add below line in function 

 register_nav_menu('headerMenuLocation', 'Header Menu Location');

and save it.

Now go to Appearance Menu and create new My Header Main Menu and select About us and privacy policy in menu and delete other pages.


Now go to header.php and comment from ul that menu so display dynamic menu.

Now add below code to display new dynamic menu 

 <?php wp_nav_menu(array(
             'theme_location' => 'headerMenuLocation',
          ));  ?>

and save this.


Now same thing do for footer  so update university_features() in functions.php and add line

 register_nav_menu('footerLocationOne', 'Footer Location One');
  register_nav_menu('footerLocationTwo', 'Footer Location Two');

and save.

and now comment footer menu and generate dynamic.

like 

 <?php wp_nav_menu(array(
                'theme_location' => 'footerLocationOne',
            ));  ?>

and save.

and now create some test menu to display dynamic.

Comments

Popular posts from this blog

Basics Of PHP

Creating App.js for Node Application

WordPress Full Guide For Developer