Trouble with language swicher
-
Please i need your help in order to fix a big problem about swich languages by plugin PolyLang.
The problem is:
When I cliked on flag French i get url like this : https://soufiane011.eb2a.com/fr/bonjour-tout-le-monde/?lang=en
Why url content 2 languages?
It should be like that:
https://soufiane011.eb2a.com/en/bonjour-tout-le-monde/
or
https://soufiane011.eb2a.com/bonjour-tout-le-monde/?lang=en
Thank you:
My website : https://soufiane011.eb2a.com
-
Hi
Could you provide a screen shot of your Permalinks (Settings > Permalinks) and your Polylang settings (Settings > Languages > Settings)?
Which theme do you use and where can I upload it?
Hi again,
Thank you for your answer, look at at these screen shots :
PolyLang1
PolyLang2
Permalink setting1
Permalink setting2
Thank you ??Ok thanks for the screenshots. That’s certainly a conflict with your theme or a plugin.
Could you test with:
* Your theme + Polylang + no other plugins?
If it fails, test with:
* Twenty Fifteen + Polylang + no other plugins?I didn’t install other plugin of language, I have just install my template traveler which has ready the files fr.mo en.mo etc…
But I don’t know how can I add polylang in the same hook and remove the old.
Thank you.I didn’t install other plugin of language, I have just install my template traveler which has ready the files fr.mo en.mo etc…
That’s not the point.
You must deactivate all your plugins (Woocommerce and the others) except Polylang.
So does it work with Polylang + only your theme?Hi again thank you for your help, i added languages switcher to both menus anglish and french it works redirections :
https://soufiane011.eb2a.com/en when i clicked on English
https://soufiane011.eb2a.com/fr when i clicked on French
But it doesn’t work with other link article,page as exemple i want to redirect like this :
when i was in : https://soufiane011.eb2a.com/en/contact
i clicked on french the result gave me home page, but me i want to redirect to corect page like that:
https://soufiane011.eb2a.com/fr/contactez-nous
Thank youDid you test with only Polylang + your theme and *no other plugins*?
Yes i did, i desabled all my plugins but languages switcher display on my menu and other switcher still display on the top i thing the template has code to switch language but i didn’t find it.
Thank youI cheked again when i disable polylang plugin the languages switch disappear from menu and top bar, and other probleme why it display in the homapage page of blog by default?
Thank you.The language switcher in the top right is certainly provided by your theme.
Please to make your test, use the language switcher provided by Polylang in the menu.
So does your french and english pages Contact works with only Polylang and your theme?It doesn’t work you can chek this on my website please : https://soufiane011.eb2a.com
i foud the file which contain switch languages how can i add polylang here
<?php /** * @package WordPress * @subpackage * @since 1.0 * */ $login_fb=st()->get_option('social_fb_login','on'); $login_gg=st()->get_option('social_gg_login','on'); $login_tw=st()->get_option('social_tw_login','on'); if(function_exists('icl_get_languages')) { $langs=icl_get_languages('skip_missing=0'); } else{ $langs=array(); } ?> <div class="col-md-9"> <div class="top-user-area clearfix"> <ul class="top-user-area-list list list-horizontal list-border "> <?php $is_user_nav = st()->get_option('enable_user_nav','on') ?> <?php if($is_user_nav == 'on'): ?> <?php if(is_user_logged_in()):?> <li class="top-user-area-avatar"> <?php $account_dashboard = st()->get_option('page_my_account_dashboard'); $location='#'; if(!empty($account_dashboard)){ $location = esc_url(add_query_arg( 'page_id', $account_dashboard, home_url() )); } ?> <a href="<?php echo esc_url($location) ?>"> <?php $current_user = wp_get_current_user(); echo st_get_profile_avatar($current_user->ID,40); echo st_get_language('hi').', '.$current_user->display_name; ?> </a> </li> <li> <a href="<?php echo wp_logout_url(home_url())?>"><?php st_the_language('sign_out')?></a> </li> <?php else: ?> <li class="nav-drop"> <?php $page_login = st()->get_option('page_user_login'); ?> <a href="#" onclick="return false;"><?php st_the_language('sign_in')?><i class="fa fa-angle-down"></i><i class="fa fa-angle-up"></i></a> <ul class="list nav-drop-menu user_nav_big social_login_nav_drop" > <li><a class="" href="<?php echo get_permalink($page_login) ?>"><?php st_the_language('sign_in')?></a></li> <?php if($login_fb=="on"): ?> <li><a onclick="return false" class="btn_login_fb_link login_social_link" href="<?php echo STSocialLogin::get_provider_login_url('Facebook') ?>"><?php st_the_language('connect_with')?> <i class="fa fa-facebook"></i></a></li> <?php endif;?> <?php if($login_gg=="on"): ?> <li><a onclick="return false" class="btn_login_gg_link login_social_link" href="<?php echo STSocialLogin::get_provider_login_url('Google') ?>"><?php st_the_language('connect_with')?> <i class="fa fa-google-plus"></i></a></li> <?php endif;?> <?php if($login_tw=="on"): ?> <li><a onclick="return false" class="btn_login_tw_link login_social_link" href="<?php echo STSocialLogin::get_provider_login_url('Twitter') ?>"><?php st_the_language('connect_with')?> <i class="fa fa-twitter"></i></a></li> <?php endif;?> </ul> </li> <?php endif;?> <?php endif; ?> <li class="nav-drop"> <a class="cursor" ><?php $current_currency=TravelHelper::get_current_currency(); if(isset($current_currency['name'])) { echo esc_html( $current_currency['name']); } if(isset($current_currency['symbol'])) { echo esc_html(' '.$current_currency['symbol']); } ?><i class="fa fa-angle-down"></i><i class="fa fa-angle-up"></i></a> <ul class="list nav-drop-menu"> <?php $currency =TravelHelper::get_currency(); if(!empty($currency)){ foreach($currency as $key=>$value){ if($current_currency['name']!=$value['name']) echo '<li><a href="'.esc_url(add_query_arg('currency',$value['name'])).'">'.$value['name'].'<span class="right">'.$value['symbol'].'</span></a> </li>'; } } ?> </ul> </li> <?php if(!empty($langs)) { foreach($langs as $key=>$value){ if($value['active']==1){ $current=' <a href="#"> <img height="12px" width= "18px" src="'.$value['country_flag_url'].'" alt="'.$value['native_name'].'" title="'.$value['native_name'].'">'.$value['native_name'].'<i class="fa fa-angle-down"></i><i class="fa fa-angle-up"></i> </a>'; break; } } echo '<li class="top-user-area-lang nav-drop wpml_nav"> '.$current.'<ul class="list nav-drop-menu" style="min-width:120px">'; foreach($langs as $key=>$value){ if($value['active']==1) continue; $link = $value['url'] ; $request_tmp = STInput::get(); $request = array(); $request['lang'] = $value['language_code']; if (is_array($request_tmp) and !empty($request_tmp)){ foreach ($request_tmp as $key2 => $value2) { if ($key2 !='lang'){ $request[$key2] = $value2; } } } if (is_search()){ $link = add_query_arg( $request , home_url()); }else { $link = add_query_arg( $request , get_permalink()); } ?> <li> <a class="image_prites_<?php echo esc_attr($value['language_code']); ?>" title="<?php echo esc_attr($value['native_name']) ?>" href="<?php echo esc_url($link) ?>"> <img height='12px' width= '18px' src="<?php echo esc_attr($value['country_flag_url']) ?>" alt="<?php echo esc_attr($value['native_name']) ?>" title="<?php echo esc_attr($value['native_name']) ?>"><span class="right"><?php echo esc_attr($value['native_name']) ?></span> </a> </li> <?php } echo '</ul></li>'; }?> <?php if(function_exists('qtranxf_init_language') and !function_exists('icl_get_languages')) { ?> <li class="top-user-area-lang nav-drop qtranslate"> <?php global $q_config; global $pagenow ; $flags = qtranxf_language_configured('flag'); $flag_dir = qtranxf_flag_location() ; $current_language = $q_config['language']; $lang_name = $q_config['language_name'][$current_language]; ?> <a class="image_prites_<?php echo esc_attr($current_language);?>" href="#" > <img height='12px' width= '18px' src="<?php echo esc_attr($flag_dir.$flags[$current_language]) ; ?>" alt="<?php echo esc_attr($lang_name) ; ?>" title="<?php echo esc_attr($lang_name) ; ?>"><?php echo esc_attr($lang_name) ; ?><i class="fa fa-angle-down"></i><i class="fa fa-angle-up"></i> <i class="fa fa-angle-down"></i><i class="fa fa-angle-up"></i> </a> <ul class="list nav-drop-menu" style="min-width:120px"> <?php $variable = qtranxf_getSortedLanguages(); if (!empty($variable) and is_array($variable)){ foreach ( $variable as $key => $value) { $qtrans_link = qtranxf_convertURL('',$value, false, true); $lang_name = $q_config['language_name'][$value]; if (is_search()){ $request = STInput::get(); $request['lang'] = $value['language_code']; $qtrans_link = add_query_arg( $request , home_url()); } ?> <li> <a title="<?php echo esc_attr($lang_name) ; ?>" href="<?php echo esc_attr($qtrans_link);?>"> <img src="<?php echo esc_attr($flag_dir.$flags[$value]) ; ?>" alt="<?php echo esc_attr($lang_name) ; ?>" title="<?php echo esc_attr($lang_name) ; ?>"> <span class="right"><?php echo esc_attr($lang_name) ; ?></span> </a> </li> <?php } }?> </ul> </li> <?php } ; ?> </ul> <?php $search_header_onoff = st()->get_option('search_header_onoff', 'on'); if($search_header_onoff == 'on'): ?> <form class="main-header-search" action="<?php echo home_url( '/' ); ?>" method="get"> <div class="form-group form-group-icon-left"> <i class="fa fa-search input-icon"></i> <input type="text" data-lang="<?php echo (defined('ICL_LANGUAGE_CODE'))?ICL_LANGUAGE_CODE:false; ?>" name="s" value="<?php echo get_search_query() ?>" class="form-control st-top-ajax-search"> <input type="hidden" name="post_type" value="post"> </div> </form> <?php endif; ?> </div> </div>
The matter is not the language switcher. The language switcher provided by your theme works.
Your problem is “Why url content 2 languages?” and it’s certainly a conflict with a plugin or you theme.
Your other problem is your Contact pages which don’t switch.
Which theme do you use where can I upload it?
I use template travler of themeforest.net i can gave you codes FTP to check please send me your private email
Please, could you provide a screenshots of:
* the pages list where appear the french page “Contactez-nous” and the english page “Contact-us” (Pages > All pages)?
* your french menu where appear “Contactez-nous” page?
* your english menu where appear ‘Contact us” page?
- The topic ‘Trouble with language swicher’ is closed to new replies.