WordPress Managed Hosting - 40% Off For 4 Months - Coupon Code: BFCM2021 Avail Now

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.

Create Faster WordPress Websites!

Free eBook on WordPress Performance right in your inbox.


    Create Faster WordPress Websites!

    Free eBook on WordPress Performance right in your inbox.

      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

        WordPress Help Zone - Ultimate WordPress Pit-Stop

        Learning WordPress? Or are you expert enough to help others? Join our WP Facebook group!