Alex Rivera | Logout

How to merge two menu managed separately in wordpress for displaying as one in front end theme?

Asked 2012-04-27T07:40:18.270
10

I am working on a wp theme for a site which is already built on wp, and having very large menu which is divided into two menu in wp admin.

I want to merge this two menu in theme in single UL. Currently it generates two menu in different div container and ul li, and is breaking the styles & js applied on it.

How can i merge this two menu into single ul li in single container?

Edit
Report

1 Answer

21

ok, so if you are using the wp_nav_menu()

try using something like

<ul id="MyMenu">
  <?php wp_nav_menu( array('menu' => 'FirstMenu', 'items_wrap' => '%3$s' ) ); ?>
  <?php wp_nav_menu( array('menu' => 'SecondMenu', 'items_wrap' => '%3$s' ) ); ?>
</ul>

using the items_wrap will remove the ul from each menu, so encapsulate the menu in an already defined ul tag, the wp_nav_menu will spit out just li tags.

See Removing the ul wrap: http://codex.wordpress.org/Function_Reference/wp_nav_menu

M

answered 2012-04-27T09:20:26.620

Your Answer