Go now. Before I beg you to stay... Yep

Create a Custom Menu for a WordPress Theme

This post is all about how to create a custom WordPress menu that you can incorporate in your WP Theme.

Register the Menu

The First step is to register the menu so that the potential user may see this:

how to create a wordpress menu

Add this to your WordPress Function.php :

register_nav_menu( 'menu-primary', 'Primary' );

Output the Menu

Next step is to add the code to display the menu in your theme. This is usually added in the header.php

<nav id="main-menu">
    <?php wp_nav_menu( array('theme_location' => 'menu-primary') ); ?>

The only headache-inducing part of creating the navigation is the Styling part. You’ll have to make sure each menu item displays correctly along with dropdown submenus.

Share This Post :


Add a Comment
  1. Thanks! Very simple and very easy. Just what I was looking for.

Leave a Reply

Anything that resembles spam is deleted. Keyword names are also changed or deleted.

Note: When posting code, enclose it in pre and code tags.
e.g. <pre><code> Add code here </code></pre>

ronangelo © 2012 - 2015 Frontier Theme