Support » Fixing WordPress » help me to create language switching button/link

  • I’m building multi-language blog and I still need the activate button(or)link which can let the users switch any language.

    I’ve coded as below and when I click(or)switch my-language it’s still find, but when I reload to the new page my-language is disappear and it automatically changes to the default language.
    can someone guide me to the right way, I think sth wrong with my code.


    // * header.php  * //
    <a href="<?php echo $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]; ?>/?lang=mylanguage">French</a>
    <a href="<?php echo $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]; ?>/?lang=eng">English</a>


    // * function.php  *//
    $_SESSION['language'] = $_GET['lang'];
    if ( $_SESSION['language'] == 'mylanguage' ) {
    require (TEMPLATEPATH .'/languages/my-language.php');
    else {
    require (TEMPLATEPATH .'/languages/english.php');  // default language


  • The topic ‘help me to create language switching button/link’ is closed to new replies.