Tagged: language switcher, wpml
Hello,
In WPML options I have set the option “skip language”, so if a page/post is not translated the flag of the missing language will not appear in the language switcher.
This works very well in the WPML language switcher but not in the Enfold language switcher : whatever the available translations, all languages flags are displayed. If a page has no translation, the user is redirected to the home page, which is not very user-friendly.
If there a way to have the Enfold language switcher behave like the standard WPML one ?
Thanks,
Bérangère
Hi Josue,
I could do so but there is no option to disable the Enfold switcher.
I could of course hide them vis css but this is not my preferred option.
Would you have a filter in functions.php to hide the Enfold switcher in the menu and the top bar ?
Regards,
Bérangère
Hi,
Yes, use this code:
add_action('after_setup_theme','avia_remove_main_menu_flags');
function avia_remove_main_menu_flags(){
remove_filter( 'wp_nav_menu_items', 'avia_append_lang_flags', 20, 2 );
remove_filter( 'avf_fallback_menu_items', 'avia_append_lang_flags', 20, 2 );
remove_action( 'avia_meta_header', 'avia_wpml_language_switch', 10);
}
Best regards,
Josue
Thanks a lot Josue, it works like a charm.
Best regards
Bérangère
Hi,
Glad to hear that it works. Feel free to reach out to us again if you have any other questions :)
Best regards,
Jordan