top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

How to merge two different menu as a single one in Wordpress?

0 votes
15 views

I am working on a site which is built on Wordpress, and having two menu, primary menu and secondary menu. I want to merge this two menu in theme and make it in a single list.

How can I merge this two menu into single list? Can anyone help me?

posted May 31, 2017 by Kavyashree

Share this question
Facebook Share Button Twitter Share Button Google+ Share Button LinkedIn Share Button Multiple Social Share Button

1 Answer

0 votes

You can combine them with this method. It keeps some of the menu classes generated by WP.

// two WordPress menus combined into one.
// first menu.
$menu = wp_nav_menu( array(
    'theme_location'=> 'secondary', // or whatever location
    'fallback_cb'   => false,
    'container'     => '',
    'items_wrap' => '%3$s',
    'echo' => false
) );
// include all of the menu items from the first inside the second menu.
wp_nav_menu( array(
    'theme_location' => 'primary', // or whatever location
    'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s ' . $menu . '</ul>',
) );
answer Jun 7, 2017 by Subhajit Maity
Similar Questions
0 votes

I am making a custom plugin for wordpress and i need to create a page in the admin menu. I already have a file called menu_list.php with the following code:

function jps_mail_list_page_entry() {
add_menu_page(
    __('JPS Mailing List'),
    'JPS Mailing List',
    'manage_options',
    'jpsNews_mailinglist',
    'jpsNews_mailing_list',
    'dashicons-email'
);
}
add_action('admin_menu', 'jps_mail_list_page_entry');

function jpsNews_mailing_list() {
    echo 'hello';
}

Now, in the plugin page i have this:

function jpsNews_activate_plugin() {
    include_once(plugin_dir_path(__FILE__).'pages/mailing-list.php');
}
register_activation_hook(__FILE__,'jpsNews_activate_plugin');

Its not working. How can i do it?

0 votes

I have a WordPress Blog which I updated regularly. I always updated my older post of my Wordpress Blog. I need a system that when I will updated any of my older post then the older post need to be shown at first as regular post. Can anybody help me?

+1 vote

I want my permalink to be accessable via more than one slug.

For example:
example-page.com/contact/1234 or example-page.com/contact-1234

0 votes

I try to get wordpress list categories with count at the end of each category's name by input the parent category as output.

Ex: I have a parent category name "alpha", and its child categories name are, Category A, Category B, Category C, Category D

I want the output display:

-Category A (5)

-Category B (2)

-Category C (6)

-Category D (7)

<?php
    $variable = wp_list_categories( array(
    'show_count' => true,
    'orderby'    => 'name',
    'style'      => 'none'
    ) );
    echo $variable; 
?>

The result of the above code display categories with the count of posts at the end, but it display all categories. Can anybody help me how I fix this problem?

Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...