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 am creating a website. The website already has a main menu which appears on the top.
But in one of the pages I want a side menu to appear on the left side of that page.

I have gone through many tutorials which say to add some code in register_nav_menus in functions.php but I cant find any such function in functions.php.

I am not able to create the menu. Kindly help me out

share|improve this question

1 Answer 1

up vote 1 down vote accepted

register_nav_menus allows you to create a new menu.

In your functions.php you can add this code to create a new menu. Then in your template file we can call the menu. You will most likely need to mess with the css to style the menu and make it look pretty.

function our_multipe_menu_setup(){
    register_nav_menus( array( 'our_left_side_menu' => 'Left Side Menu' , 'our_second_menu' => 'Our Second Menu' ) );
}
add_action( 'after_theme_setup', 'our_multiple_menu_setup' );

Then in the admin area you should now see a menu under apperance > menu that is called Left Side Menu.

In your template files, as index.php, page.php or any other template file, you can display the menu with this:

wp_nav_menu( array('menu' => 'left_side_menu' ) );

There are ways to customize how the menu is displayed but this is the most default and simple way to get the menu.

Wrap it in a html element and style the HTML with CSS in your style.css file.

I suggest using Firefox and Firebug to inspect your website, helps a lot with styling.

Getting the menu to be on the left side of the page is going to be the HTML and CSS part of the gig.

!Edit:!

The first solution I had provided was to create several menus. To create a single menu, this should work:

function our_single_menu_setup(){
   register_nav_menu( 'left_side_menu', 'Left Side Menu' );
}
   add_action( 'after_theme_setup', 'our_single_menu_setup' );
share|improve this answer
    
i tried adding this function our_menu_setup in the functions.php but the menu did not show up in the appearance-menu section –  Anshul Jain Jul 10 '13 at 5:47
    
I will edit my answer, I tried to make it as simple as possible and over looked register_nav_menus still requires an array. –  Ronburgundy Jul 10 '13 at 12:40
    
I have edited my answer hopefully that helps. –  Ronburgundy Jul 10 '13 at 12:46
    
yes it worked.thanks a lot.. –  Anshul Jain Jul 11 '13 at 5:53
    
Happy to help. Please select the Check mark on the left side of my answer to select it as the best answer. –  Ronburgundy Jul 11 '13 at 11:40

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.