Upgrade & Secure Your Future with DevOps, SRE, DevSecOps, MLOps!

We spend hours on Instagram and YouTube and waste money on coffee and fast food, but won’t spend 30 minutes a day learning skills to boost our careers.
Master in DevOps, SRE, DevSecOps & MLOps!

Learn from Guru Rajesh Kumar and double your salary in just one year.


Get Started Now!

How to Display Navigation Menus of our Custom Theme in WordPress? Part-8

How to Display Navigation Menus of our Custom Theme in WordPress?

In blog Part-7, we have seen how to register Navigation Menus of our Custom Theme. We have to create pages to make menus.

Step 1:- Go to Dashboard->Pages->Add New Page. Name the first menu as Home page, second About page, third Menu page, forth Specials page, fifth Events page, sixth Gellary page, seventh Chefs page, eighth Contact page, ninth Book a Table page. Click Publish.

Example of Home Page

Step 2:-Go to Appearance->Menus>Pages Check menu items boxes which are created and Click Add to Menu.

Menu Structure

Step 3:Rearrange menus name according to your needs by dragging its.

Step 4:– To Display Location Checkbox of Primary Menu and Click Save Menu.

Step 5:- Go to index.php file of customtheme folder and delete the given nav-menu to see your created new nav-menu.

Step 6:– To display nav-menu, use pre-defined wp_nav_menu( array $args = array() ) method in WordPress. To more details of this method, visit https://developer.wordpress.org/reference/functions/wp_nav_menu/.

wp_nav_menu(array(
'menu' =>'primary-menu', //id of Primary Menu
'container' => '',
'items_wrap' =>'<ul class="nav navbar-nav navbar-right headerMenu">%3$s</ul>'
));

Step 7:- Put this wp_nav_menu( array $args = array() ) method in nav-menu section

Step 8:- Refresh the custom theme site.

Thanks

Certification Courses

DevOpsSchool has introduced a series of professional certification courses designed to enhance your skills and expertise in cutting-edge technologies and methodologies. Whether you are aiming to excel in development, security, or operations, these certifications provide a comprehensive learning experience. Explore the following programs:

DevOps Certification, SRE Certification, and DevSecOps Certification by DevOpsSchool

Explore our DevOps Certification, SRE Certification, and DevSecOps Certification programs at DevOpsSchool. Gain the expertise needed to excel in your career with hands-on training and globally recognized certifications.