Call Today
}
Hours

Mon – Fri, 8am to 5pm

How to Add a Custom Navigation Menu in WordPress

by | Sep 13, 2012 | Tutorials, Wordpress | 0 comments

How to Add a Custom Navigation Menu in WordPress

If you’ve been working with WordPress as long as I have then it is inevitable that you will need to add custom features and functionality to your WordPress site. It is easier than you think to add your own custom navigation menu in WordPress.

You will need to edit the functions.php file, and the php file where you want to add your custom navigation menu. This could be the header.php file, the index.php file, the archive.php file, or the footer.php file. First, we need to add a line of code at the bottom  of the functions.php file in order to enable the custom menu. Copy and paste this line of code:

add_theme_support( 'menus' );

Now that you have enabled this, you can create custom menus in the Appearance section of your WordPress Admin Area. You can order your menu any way that you’d like. You can include posts, pages and custom urls in your custom navigation menu in WordPress. To add your custom navigation menu in WordPress wherever you’d like, simply paste the following code:

<?php wp_nav_menu( array( 'sort_column' => 'menu_order', 'container_class' => 'menu-footer' ) ); ?>

In the PHP above you are asking for a WordPress navigation menu, and what the code is telling WordPress to do is to use the sort order that you had setup for your menu under the Appearance menu. this takes the order of the menu itself and displays your menu items in that order. As you add menus to your site, you will see WordPress update with menu locations where you can specify what menus to use and where they will be placed within your site. Notice the “+” symbol in the menu section. Here, you can create as many menus as you’d like, just be sure to name your custom menu something that you will recognize, to make it easy to remember where you want to place it.

custom_navigation_Menu_in_wordpress

custom_navigation_menu_in_Wordpress_2

Next, the container class determines the class that you will use in your css to style this menu. The reason that you do it this way, is because you might have several menus in different places, so this makes it easy for you to style in your CSS Stylesheet.

As you can see, this makes it really easy to implement your own custom navigation menu in WordPress quickly and easily. This is just one of the things that you can do to customize your WordPress site and make it easy for your visitors to find what they are looking for.

Divi WordPress Theme