Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I used wp menus in the past but always registering a location and then using:

<?php wp_nav_menu( array( 'theme_location' => 'header-menu' ) ); ?>

To display a menu on that location on my theme I would first create a menu, and then assign it to that location.

Well now what I would like to do is to create all the menus I want using some standard name like my-menu-1, my-menu-2, my-menu-x. And then I want to display those menus on my theme but without using any location, just printing them using code identifying them by name.

How could I do that?

share|improve this question
    
General notice: If you are developing a theme for distribution, you should use theme location not menu name. See this post by Chip Bennett. –  Stephen Harris Apr 22 '12 at 11:09
add comment

1 Answer 1

up vote 0 down vote accepted

Umm u can do that easily. And this is the way I do

how i register my menu in function.php

add_action('init', 'register_custom_menu'); 
function register_custom_menu() {
register_nav_menu('custom_menu', __('Custom Menu'));
}

Then in ur admin panel u create different the menu by ur disired name. And get the menu where ever u want like this. EX:- if I made two menu name "Menu 1" and "Menu 2"

wp_nav_menu(array('menu' => 'Menu 1'));
wp_nav_menu(array('menu' => 'Menu 2'));
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.