-
AuthorPosts
-
January 11, 2022 at 12:36 pm #1335063
Hello,
i want to use the w-p-m-l language switcher in the main menu with a dropdown for choosing the language. But no matter how I configure the language switcher in wpml. Two flags are always displayed, which probably come from enfold. Now I have tried to remove the enfold language switcher with the following code:
function avia_remove_main_menu_flags(){ remove_filter( 'wp_nav_menu_items', 'avia_append_lang_flags', 9998, 2 ); remove_filter( 'avf_fallback_menu_items', 'avia_append_lang_flags', 9998, 2 ); remove_action( 'avia_meta_header', 'avia_wpml_language_switch', 10); } add_action('after_setup_theme','avia_remove_main_menu_flags');
But the flags are still there and the wpml language switcher is not shown. is there a way to remove the enfold language switcher and use the w-p-m-l language switcher?
i look forward to hear from you
Thanks
Chris
- This topic was modified 2 years, 10 months ago by Chris_85.
January 12, 2022 at 7:11 am #1335189Hey Chris_85,
Thank you for the inquiry.
The old filters have been removed from the latest version of the theme. You can use this snippet instead.
remove_filter( 'wp_nav_menu_items', array( "avia_WPML", 'handler_append_lang_flags' ), 9998, 2 ); remove_filter( 'avf_fallback_menu_items', array( "avia_WPML", 'handler_append_lang_flags' ), 9998, 2 );
Or add this css code in the Quick CSS field to hide the default language flags.
.av_extra_header_active .avia_wpml_language_switch { display:none; }
Related thread: https://kriesi.at/support/topic/language-flags-in-the-top-bar/#post-1320245
Best regards,
IsmaelJanuary 17, 2022 at 5:46 pm #1335903Hi Ismael,
thanks for your answer. I dont want to use the CSS solution. Unfortunately the filters don’t work. When I use the filters, the flags are shown twice in the header. I would like to turn off the enfold flags and use WPLM’s language switcher, please.
Best regards
Chris
January 18, 2022 at 5:19 am #1335953Hi,
Sorry about that. We forgot to replace add_filter with the remove_filter function. This is the updated code.
remove_filter( 'wp_nav_menu_items', array( "avia_WPML", 'handler_append_lang_flags' ), 9998, 2 ); remove_filter( 'avf_fallback_menu_items', array( "avia_WPML", 'handler_append_lang_flags' ), 9998, 2 );
Thank you for your patience.
Best regards,
IsmaelJanuary 18, 2022 at 5:46 pm #1336076Hi Ismael,
thanks for your answer. Nothing changed with the remove_filter. The flags are still there and the wpml language switcher is not shown. Can you have a closer look plz?
best regards
Chris
January 19, 2022 at 7:13 am #1336122Hi,
Thank you for the update.
Looks like you will now have to disable the language switcher in the WPML settings. Please check this thread.
// https://kriesi.at/support/topic/remove-wpm-flags-in-menu/#post-1312211
And if you want to display the default language switcher, you will have add it manually.
// https://wpml.org/documentation/getting-started-guide/language-setup/custom-language-switcher/
Best regards,
IsmaelJanuary 19, 2022 at 8:31 am #1336137Hi Ismael,
this is still the language switcher from enfold. so we can’t find a solution here. Please take a closer look at the problem. I just want to disable the enfold language switcher and use the WPML language switcher.
Thanks
Chris
January 19, 2022 at 9:03 am #1336144Hi,
We adjusted the language switcher option in the WPML settings to display the language dropdown and we added this code in the functions.php file to completely remove the default flags.
function ava_custom_script() { ?> <script> (function($) { $(document).ready(function() { $('.av-language-switch-item').remove(); }); })(jQuery); </script> <?php } add_action('wp_footer', 'ava_custom_script');
There is a slight delay on the flag removal, so we added this css code to make sure that flags do not display at all on load.
.av-language-switch-item { display: none; }
Best regards,
IsmaelJanuary 19, 2022 at 10:14 am #1336150thanks, is working now :-) thank you for your help! So the remove filters didn’t work, right?
January 20, 2022 at 8:48 am #1336310 -
AuthorPosts
- You must be logged in to reply to this topic.