• Hi!
    First of all thank you very much for this great plugin.
    I’m not good at php, so I’d like to ask you if there’s a way to keep the language after pressing the ‘search’ or ‘home’ button?
    I have 2 languages, English and German, while German is default. So when a user switches to English everything works fine until he tries to use the sidebar searchform or the ‘Home’ button. It switches back to German…
    I’m using version 1.3.4.15 and WP 2.5
    Any solution or code that I can add to my pages?

    Cheers, Candy

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter candy99

    (@candy99)

    Okay, solved by myself. Anyone who’s interested… add these lines to your searchform (inside the <form – Tag) :
    <input type=”hidden” value=”<?php if ($language == ‘en’)
    echo “en”;
    else
    echo “de”; ?>” name=”language”/>

    If you have more than 2 languages you can alter it with elseif

    Cheers, Candy

    That doesn’t work on WP 2.7 and WP_Multilingual 1.3.4.15

    Disabled the plugin and it works fine, any other ideas?

    how about usage a $GLOBALS[‘language’];

    for example action=”/<?php echo $GLOBALS[‘language’];?>/search/” in form search.. sorry but search form ways and home link not handled by url_change

    dont’t know if It could be useful. I use wordpress 2.7.1 and use wp-multilingual plugin. I also got troubles with multilingual and search plugin (clicking on search button, language resetted to default).
    I solved in this way:
    first I wrote a function in the header.php file of my theme to recognize the actual language used by visitor. This is the code:

    function language (){
    global $actual_language;
    $my_url = "https://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
    $actual_language = substr($my_url , -2, 2);
    return $actual_language;
    }

    then, I add an hidden field to the form in the searchform.php file of my theme:

    <input name="language" type="hidden" id="language" value="<?php echo language()  ?>"/>

    that’s all.

    this hidden field append “&language=actual_language” to your search query so the action of your submit button becomes:action=”your_blog_url/?s=word_you_are searching_for&language=actual_language”

    this prevent to change to default language when you use the search module of your blog

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: WP_Multilingual] wp_multilingual “Search” always switches back to default language’ is closed to new replies.