Novry
Novry

Reputation: 23

How to merge 2 list menus in Wordpress

Does anyone know the way or plugin needed to combine/merge 2 list menus into 1 menu list in Wordpress?

Upvotes: 0

Views: 546

Answers (1)

Gufran Hasan
Gufran Hasan

Reputation: 9373

Combines the markup of two menu areas into one. I have not tried it but hopefully it will work for you.

Get the markup list items in the first menu.

$menu = wp_nav_menu( array(
    'theme_location'=> 'menu-1',
    'fallback_cb'   => false,
    'container'     => '',
    'items_wrap' => '%3$s',
    'echo' => false
) );

Display menu-2 with all the list items from menu-1 included.

wp_nav_menu( array(
    'theme_location' => 'menu-2',
    'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s ' . $menu . '</ul>',
) );

Reference link

Upvotes: 1

Related Questions