WordPress Hosting Coupon Code | 3 Months | 100% OFF Get Offer

Create Custom Navigation Menu in WordPress Themes

Moeez — August 9, 2017 2 Minutes Read
How to Create Custom Menu in WordPress

If you are running a WordPress website and want to create a WordPress custom menu, then you are in the right place.



For many people, this default styling and design does not cut it. This is why there is a huge demand for custom navigation menus for WordPress themes. In this article, I will cover how to create custom menu in WordPress through the WordPress custom menu code.

How to Create Custom Menu in WordPress

The first step in creating a custom WordPress navigation menu is to register the menu. To start with, add the following code to functions.php (located in the theme folder of your WordPress website):

This function comes with a long range of parameters that could be found at WordPress.org Codex. Here is a default list of available parameters:

At this point, go to the WordPress Admin > Appearance > Menus. Once there, either create or edit a new menu.

It often happens that a user needs to add additional navigation menu location. For this use the following code snippet:

Now that you have a new menu location, it is easy to add menu items. For this follow this great tutorial on adding and organizing custom menus.

Display Custom Navigation Menu

The custom navigation menu is ready for display. For this, add the code to the template file of the theme, at the location where you wish to display it.

Style the Menus

Styling the menu is a simple task. Add the following CSS class, .wpblog-menu-class (located inside the theme folder) for adding style to the menus:

Note: Best practice is to add above code in separate file.

Conclusion

In this tutorial, I have not only discussed how to create a custom menu in WordPress but also how to style and display it through the WordPress custom menu code.

Remember that you could add multiple menu locations for improving website navigation. If you need help with the code, do leave a comment and I will get back to you.

Subscribe to Get a FREE WordPress Ebook Right in Your Inbox

WPblog provides the complete guide to launch your WordPress website completely FREE!

Moeez is ‘The’ blogger in charge of WPblog. He loves to interact and learn about WordPress with people in the WordPress community. Outside his work life, Moeez spends time hanging out with his friends, playing Xbox and watching football on the weekends. You can get in touch with him at moeez[at]wpblog.com.

THERE'S MORE TO READ

Newsletter