WordPress.org

Forums

[resolved] get local language variable in a session, maybe ? (3 posts)

  1. carslberg2014
    Member
    Posted 1 year ago #

    Hi
    I'm currently working on a site that uses fancybox to open a layer with an iframe over the wordpress page. The iframe loads a contact form which is just a free-standing php page that's not part of the WordPress set-up.

    The problem I have is that I need to change the language of the labels in the contact form. Is there a langauge session variable that I can access without including all the WordPress functions in my php page ?

    ... or is there a way of loading a wordpress contact form page (without the site header and footer) into the iframe ?

    thanks for any advice you can give :)

  2. carslberg2014
    Member
    Posted 1 year ago #

    ha! I've just figured it out!

    For information :

    1) In the top of my theme pages (index.php) etc I put

    <?php session_start();
    /**
     * The template for displaying all pages

    2) near the top of header.php I put

    <?php $_SESSION['curr_lang'] = get_bloginfo( 'language' );
     #echo "lang = ".$_SESSION['curr_lang'];
    ?>

    3) in my external php page I put

    <?php session_start();
    echo "lang = ".$_SESSION['curr_lang']."<br />";
    ?>

    which outputs

    lang = fr-FR

    so that's looking very promising !

  3. carslberg2014
    Member
    Posted 1 year ago #

    resolved

Topic Closed

This topic has been closed to new replies.

About this Topic