Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #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.
    #1335189

    Hey 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,
    Ismael

    #1335903

    Hi 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

    #1335953

    Hi,

    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,
    Ismael

    #1336076

    Hi 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

    #1336122

    Hi,

    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,
    Ismael

    #1336137

    Hi 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

    #1336144

    Hi,

    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,
    Ismael

    #1336150

    thanks, is working now :-) thank you for your help! So the remove filters didn’t work, right?

    #1336310

    Hey!

    Yes, the previous filters did not work, so we removed them. Please keep the script in the functions.php file.

    Best regards,
    Ismael

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.