Support » Plugin: WP Responsive Menu » for more than one menu / multiple menu
for more than one menu / multiple menu
-
Hi
If I have more than one menu & I want to apply it in all the menu for responsive then what I do because it allows us only choose one menu here- “Choose the wordpress menu”[ redacted, support is offered via the forum and not email ]
-
Hello,
First of all, your plugin is great, thanks a lot!
I would also like to know if it is possible to select more than one menu.
In fact, my website is translated in 2 languages via Polylang plugin and therefore there are 2 primary menus that I would like to make responsive.Is there a simple way to do that ?
Thank you for your answer.
HI CdiEll,
Currently its not possible to use it for 2 menus but yes I am working on an upgrade where you can combine 2 menus to create a single menu and hide the other menus on mobile.
Thanks
– NirmalHi Nirmal and CdiEll,
Great plugin.
Here are some modifications to support several languaages (tested with Polylang).
In admin.php file, replace the wprmenu_general_settings_menu() function with the following code
function wprmenu_general_settings_menu() { $options = get_option('wprmenu_options'); $menus = get_terms('nav_menu',array('hide_empty'=>false)); $languages = get_terms('language',array('hide_empty'=>false)); // get list available languages foreach ($languages as $l){ // display a list box for each language echo $l->name; ?> <select name="wprmenu_options[menu<?php echo $l->term_id; ?>]" > <?php foreach( $menus as $m ): ?> <option <?php if($m->term_id == $options['menu'][$l->term_id]) echo 'selected="selected"'; ?> value="<?php echo $m->term_id ?>"><?php echo $m->name ?></option> <?php endforeach; ?> </select> <?php } }
In the wprmenu_options_validate($input) function, change the commented lines below by the joined code :
//enabled / dispabled //if(isset($input['menu'])) { //$options['enabled'] = $input['enabled']; //} //section "General", option "menu" //if(isset($input['menu'])) { // $options['menu'] = $input['menu']; // if($options['menu'] == false || $options['menu'] == null || $options['menu'] == 0 || $options['menu'] == '') $options['menu'] = ''; //} $languages = get_terms('language',array('hide_empty'=>false)); // get list available languages foreach ($languages as $l){ $var[$l->term_id] = $input['menu'.$l->term_id]; } $options['menu']=$var; if(isset($input['menu_symbol_pos'])) { $options['menu_symbol_pos'] = $input['menu_symbol_pos']; }
And to finish, update the wp-responsive-menu.php file, replace the
<ul id="wprmenu_menu_ul">
(from<ul ...>
to</ul>
) code with the folowing one :<ul id="wprmenu_menu_ul"> <?php $active_language_long = get_bloginfo('language'); $active_language = substr ( $active_language_long , 0, 2); $available_languages = get_terms('language',array('hide_empty'=>false)); foreach ($available_languages as $l){ if ($l->slug == $active_language){ $active_language_term_id = $l->term_id; } } $menus = get_terms('nav_menu',array('hide_empty'=>false)); if($menus) : foreach($menus as $m) : if($m->term_id == $options['menu'][$active_language_term_id]) $menu = $m; endforeach; endif; if(is_object($menu)) : wp_nav_menu( array('menu'=>$menu->name,'container'=>false,'items_wrap'=>'%3$s')); endif; ?> </ul>
Hi Iznogood1,
Thank you so much for your help, this works fine!
You made my day 😉Hi, I am seeking for a solution to this as well. Editing the source code is not advisable.
Unfortunately, the plugin does not have a built-in way to change which menu to use on different languages. Not that I can find anyway.
To the author of the plugin, here’s a piece of one line code, that could help, in file wp-responive-menu.php, line 77, version 2.0.5.
wp_nav_menu( array('menu' => apply_filters( 'wpr_set_nav_menu', $menu->name ),'container'=>false,'items_wrap'=>'%3$s'));
This would then make it easy hook into the code and change it dynamically via a custom plugin or your theme functions.php file.
add_filter( 'wpr_set_nav_menu', 'change_menu_on_english', 10, 1 ); function change_menu_on_english( $menu_name ) { if( pll_current_language() == 'en' ) { $menu_name = 'English menu name'; } }
It’s a great plugin, but this feature would be greatly appreciated. 🙂
Regards
Vayu
- The topic ‘for more than one menu / multiple menu’ is closed to new replies.