Tagged: 

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #247392

    Hi I have the same need than in this thread :
    https://kriesi.at/support/topic/wpml-language-selector-text-instead-of-flag/

    I’ve guessed the name of the page wp-contentthemesenfoldconfig-wpmlconfig.php (nice name btw :) ) has changed and is now in enfold/config-wpml/config.php

    I’ve created a copy within enfold-child/config-wpml/config.php and made the change as detailed in the previous thread. But nothing happened on the website (www.sourcedeprovence.com). What did I made wrong?

    Many thanks for your help.
    Thomas

    #248051

    Hey Simple!

    Can you post a link to your language flags please -.maybe you need to hide the flag images with css and show the text instead.

    Regards,
    Peter

    #248058

    Hey Peter,
    Thanks for your reply. Here is the link:
    http://www.sourcedeprovence.com
    Regards,
    Thomas

    #248648

    Hey!

    Please place this code into your child theme functions.php file:

    
        if(!function_exists('avia_append_lang_flags'))
        {
            //first append search item to main menu
            add_filter( 'wp_nav_menu_items', 'avia_append_lang_flags', 20, 2 );
            add_filter( 'avf_fallback_menu_items', 'avia_append_lang_flags', 20, 2 );
    
            function avia_append_lang_flags( $items, $args )
            {
                if ((is_object($args) && $args->theme_location == 'avia'))
                {
                    global $avia_config, $sitepress;
    
                    if(empty($avia_config['wpml_language_menu_position'])) $avia_config['wpml_language_menu_position'] = apply_filters('avf_wpml_language_switcher_position', 'main_menu');
                    if($avia_config['wpml_language_menu_position'] != 'main_menu') return $items;
    
                    $languages = icl_get_languages('skip_missing=0&orderby=custom');
    
                    if(is_array($languages))
                    {
                        foreach($languages as $lang)
                        {
                            $currentlang = (ICL_LANGUAGE_CODE == $lang['language_code']) ? 'avia_current_lang' : '';
    
                            if(is_home() || is_front_page()) $lang['url'] = $sitepress->language_url($lang['language_code']);
    
                            $items .= "<li class='language_".$lang['language_code']." $currentlang'><a href='".$lang['url']."'>";
                            $items .= "	<span class='language_flag'>".$lang['native_name']."</span>";
                            $items .= "</a></li>";
                        }
                    }
                }
                return $items;
            }
        }
    
    

    If you don’t use a child theme add it to enfold/functions.php.

    Best regards,
    Peter

    #288014

    Hi,

    I have followed the instructions above (copied the code in the child theme functions), but the flags are still there.
    www. lepure. com

    I would like to have a dropdown menue with the text of the different languages, but without the flags.

    Thank you,

    Julia

    #288604

    Hey!

    You can use this code to remove the flags completely – insert it into the functions.php file:

    
    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);
    }
    

    Then go to WPML > Languages and tick the “Display the language switcher in the WP Menu” option. You can also configure the language switcher type (dropdown, list, etc.) on this option page.

    Regards,
    Peter

    #288705

    Thanks Peter!

    I tried to add it into child theme but I got an error message. Then deleted it and tried the theme, but got the same and the site was not accessible anymore.

    Parse error: syntax error, unexpected ‘function’ (T_FUNCTION) in /home2/lepure/public_html/wp-content/themes/enfold/functions.php on line 486

    Parse error: syntax error, unexpected ‘function’ (T_FUNCTION) in /home2/lepure/public_html/wp-content/themes/enfold-child LE PURE/functions.php on line 4

    Any other options?

    Thanks,
    Julia

    #289626

    Hi!

    I tested the code and it worked for me. Please open up enfold/functions.php, delete the entire code within the file and insert this code: http://pastebin.com/raw.php?i=jtyDHtem

    Best regards,
    Peter

    #291283

    Hi Peter,

    unfortunately I get the same error message.

    Parse error: syntax error, unexpected ‘ad’ (T_STRING) in /home2/lepure/public_html/wp-content/themes/enfold/functions.php on line 507

    Any chance it’s a problem with Hostgator’s php settings?

    I could provide you with the login data to Hostgator and/or WP, if you wish.

    Thanks,
    Julia

    #291372

    Hi!

    Thank you for the update.

    Can you please provide us with the login details? We would like to check it. I doubt if it has anything to do with the php settings on your server but please do ask if possible. I tested Dude’s functions.php on my installation and it works fine.

    Best regards,
    Ismael

    #291462
    This reply has been marked as private.
    #292561
    This reply has been marked as private.
Viewing 12 posts - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.