Site logo

Archived topic

WPGlobus in mobile view don't allow select languages. Web menu problem?

11 replies · Started by Daniel Gómez on October 29, 2019

Viewing posts 1–12 of 12

I've a multilingual site, using the WPGlobus plugin. Actually all works fine when is in desktop view, but when pass to mobile view doesn't permite select a language, the little arrow what don't appear in the menu for switch in the languages. Why happen this problem?
Thanks for all.

Hi there,

It looks like the arrow has been removed on desktop as well - are you using a function to remove the arrow possibly?

Let me know :)

I don't use any function to remove the arrows. Only I install and configure the plugin normally, without extras functions.
Thanks!

Hi there,

Try this function:

add_filter( 'nav_menu_item_title', function( $title, $item, $args, $depth ) {
	$role = 'presentation';
	$tabindex = '';
	
	if ( 'click-arrow' === generate_get_option( 'nav_dropdown_type' ) ) {
		$role = 'button';
		$tabindex = ' tabindex="0"';
	}
	
	if ( isset( $args->container_class ) && 'main-nav' === $args->container_class ) {
		foreach ( $item->classes as $value ) {
			if ( 'menu_item_wpglobus_menu_switch' === $value ) {
				$icon = generate_get_svg_icon( 'arrow' );
				$title = $title . '<span role="' . $role . '" class="dropdown-menu-toggle"' . $tabindex . '>' . $icon . '</span>';
			}
		}
	}
	
	return $title;
}, 10, 4 );

Let me know :)

Hi,
Now appear the arrow in menu, but in submenus too. The arrow appear next to the language names not in the end, but this is quite close to optimal result.
Thanks!!

I just updated the function above - can you give it another shot?

Yes!

Working now? :)

Yes, the function works fine, but the arrow icon appear hooked to the language name instead to separate. In mobile view is complicated press it.

Thanks for you work!

Let's try adding this:

add_filter( 'nav_menu_css_class', function( $classes ) {
    if ( in_array( 'menu_item_wpglobus_menu_switch', $classes ) ) {
        $classes[] = 'menu-item-has-children';
    }

    return $classes;
} );

That might make it so the first function I shared is no longer necessary.

Let me know :)

Ohhh yeah! Perfect now!
Thanks very much!!

You're very welcome :)

This archived topic is closed to new replies.