WordPress Menu Tutorial

One of the best feature of WordPress is the ability to create custom menu for your navigation. Now you can choose which pages should be on your main menu, secondary menu, and even footer links.

I created the steps below for your convenience and reference when working a WordPress theme.

Add Menu on functions.php

On your theme’s function.php file let’s declare a menu using the code below:

register_nav_menus( array(
		'topmenu' => __( 'Primary Navigation', 'mytemplate' ),
		'sidemenu' => __( 'Secondary Navigation', 'mytemplate')
) );

Display the Menu List on the WP Theme

To get the WordPress menu and display on theme we need to have something like the code below:

<nav class="mainnav">
	<?php wp_nav_menu(array ('theme_location' => 'topmenu')); ?>
</nav>
<nav class="sidebar">
	<?php wp_nav_menu(array ('theme_location' => 'sidemenu')); ?>
</nav>

Creating Menu on WP Dashboard

Now you can go to WP dashboard > Appearance > Menu.  Just create a new list and match it to the Theme Location widget on the left side. The WordPress menu list can be dragged if you want to change their orders.

Menu wordpress

Click save and your done!

*Some links may contain affiliate links. I may get small commission from your purchases to fund this website and to avoid annoying ads.