Reputation: 492
My current project is Multilingual in :
I'm working one making custom language switcher with Qtranslate plugin.And this is what I want to do:
What I did, I appended to the header.php after wordpress call the menu this code:
<?php
$current_lang=qtranxf_getLanguage();
if($current_lang=="ar"){
echo "<li class='menu-item menu-item-type-custom'>". " <a class ='qtranxs_flag_en qtranxs_flag_and_text' href='http://127.0.0.1/idevlab.com/comtec.com/idevtra/'>Englsih</a>"."</li>";
}else{
echo "<li class='menu-item menu-item-type-custom'>". " <a class ='qtranxs_flag_ar qtranxs_flag_and_text' href='http://127.0.0.1/idevlab.com/comtec.com/idevtra/ar'>العربية</a>"."</li>";
}
?>
But, the URL appears well, but unfortunately it reloads the website to the current content not to the other synchronized content.
I tried to inspect the element of the widgets and I could only figure that they use this class in the URL for the language switcher ,
<a class ='qtranxs_flag_en qtranxs_flag_and_text
But, it do nothing with my and it seems that it calls the last cashed language from the browser or the DB and I don't know how ?
So, I'd be highly appreciated if you could guide/help me to make this costume language switcher.
Upvotes: 2
Views: 5471
Reputation: 1127
Here is the solution for: Just text, hide current lang, hide menu title, inline items
#qtransLangSwLM?flags=none&title=none¤t=hidden&type=AL
Here is a reference of the available options
type = [LM|AL]
title = [none|Language|Current]
current = [shown|hidden]
flags = [none|all|items]
lang_names = [shown|hidden]
colon = [shown|hidden]
Upvotes: 1
Reputation: 31
Add a custom link menu item with the following code as url:
#qtransLangSwLM?flags=none&title=current¤t=hidden
Leave the other fields empty.
Upvotes: 3