I am tired...

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') ); ?>
</nav>

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 :

2 Comments

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

Leave a Reply

Please write your comments in english. I delete anything that even remotely resembles spam.

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

ronangelo © 2012 - 2014 Frontier Theme
css.php