Follow Me

How to add multiple menu in wordpress

Fri, Jul 2, 2010

Wordpress

Hi Guys,

Recently I need to implement multiple menu in wordpress. Often we comes in the situation where theme support only 1 menu whereas we need more than it. There is simple way I found in wordpress to do it by changes in few lines of code.

register_nav_menus function is the primary menu (default menu in wordpress), you can find in function.php file. You need to copy paste it for footer menu (for example).

<?php
// This theme uses wp_nav_menu() in one location.
register_nav_menus( array(
    'primary' => __( 'Primary Navigation', 'twentyten' ),
) );

register_nav_menus( array(
	'footer' => __( 'Footer Navigation', 'twentyten' ),
) );
?>

Now you just need to call a simple function for footer menu in footer.php (or your desired location may be in header.php)

 <?php wp_nav_menu( array( 'container_class' => 'footer-menu', 'theme_location' => 'footer' ) ); ?>

Now go to appearance->menus for setting links under footer menu.

That’s It.

Hope this tutorial help you to build multiple menus on your desired location.

Note: menus tab available in wordpress 3.0 or latest versions.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Blogplay
  • blogmarks
  • Design Float
  • DZone
  • MySpace
  • Reddit
  • StumbleUpon
  • Twitter
, , , , ,

Related Posts:


Recent Posts:

  • Best collection of firefox addons for web designers and developers
  • .htaccess basic features with example
  • how to include an external css and js with javascript dynamically
  • How to preserve line breaks in textarea mysql data
  • how to generate excel report with php and mysql
  • 2 Comments For This Post

    1. Svetlana Says:

      Thanks a lot. This was exactly what I was looking for.

      But I have to add additional element (heading) above the list element, which contain the menu items. Do you have an idea how I can do this?

      Thanks again for your tip.

    2. admin Says:

      Thanks svetlana.. I think you are looking for multi level menu/ menu having menu items.. This post guides you to add single level menu. For multi level menu visit http://smartcoderszone.com/2010/07/how-to-implement-multi-level-menu-in-wordpress/

    Leave a Reply