Tagged: enfold wpml
-
AuthorPosts
-
April 4, 2014 at 11:55 am #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.
ThomasApril 7, 2014 at 7:08 am #248051Hey 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,
PeterApril 7, 2014 at 7:19 am #248058Hey Peter,
Thanks for your reply. Here is the link:
http://www.sourcedeprovence.com
Regards,
ThomasApril 8, 2014 at 7:16 am #248648Hey!
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,
PeterJuly 7, 2014 at 3:33 pm #288014Hi,
I have followed the instructions above (copied the code in the child theme functions), but the flags are still there.
www. lepure. comI would like to have a dropdown menue with the text of the different languages, but without the flags.
Thank you,
Julia
July 8, 2014 at 5:10 pm #288604Hey!
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,
PeterJuly 8, 2014 at 11:58 pm #288705Thanks 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,
JuliaJuly 10, 2014 at 5:29 pm #289626Hi!
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,
PeterJuly 14, 2014 at 11:05 pm #291283Hi 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,
JuliaJuly 15, 2014 at 4:25 am #291372Hi!
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,
IsmaelJuly 15, 2014 at 9:46 am #291462This reply has been marked as private.July 17, 2014 at 4:55 pm #292561This reply has been marked as private. -
AuthorPosts
- You must be logged in to reply to this topic.