• So I started my header.php with:

    $lang = $_GET['lang'];
    if ($lang == 'FR' || $lang == 'EN') {
    	simpleSessionSet('lang', $lang);
    }

    and below, I added:

    <ul>
                    	<li><a href="<?php echo home_url(); ?>?lang=FR">FR</a></li>
                        <li><a href="<?php echo home_url(); ?>?lang=EN">EN</a></li>
                    </ul>
    
    $siteLang = simpleSessionGet('lang', 'FR');
    echo 'Session lang = '. $siteLang;

    Now irrespective of whatever link I click, my $siteLang is getting echoed as FR.

    Any idea ?

    http://wordpress.org/extend/plugins/simple-session-support/

Viewing 1 replies (of 1 total)
  • Plugin Author Peter Wooster

    (@pkwooster)

    It appears that the session value is not being set. Use a default in the simpleSessionGet that isn’t either ‘EN’ or ‘FR’. In the setting code add a line to set the value if the language is unknown, and see if that is set. That way you can tell where the error is.

    It’s also possible that sessions are not working properly, the most common cause is cookies not enabled, also read my post http://devondev.com/2012/02/03/using-the-php-session-in-wordpress/ for more details on how sessions work.

Viewing 1 replies (of 1 total)
  • The topic ‘What I am doing wrong here ? Not working.’ is closed to new replies.