• Resolved kenjidd

    (@kenjidd)


    Hi guy’s
    i need help with transposh.
    I can’t find the right $tag to switch lang with transposh.
    I have a slider with 2 category, one in french and the other in english. What i need to do is to change the category slider with the right language.

    Here is my code :

    <?php
       if($lang == 'fr')
          echo do_shortcode ('[promoslider width="930px" height="350px" category="francais"]');
       else if($lang == "en")
          echo do_shortcode ('[promoslider width="930px" height="350px" category="anglais"]');
    ?>

    i know my code is good cause it work with qtranslate, and i know that the problem is because i have the wrong $tag it is NOT $lang that’s for sure, so what it is ????

    i tried with $languages, $language, $transposh etc…. so many !!!! lol
    is someone can help ? please….

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hello,

    $my_transposh_plugin->target_language

    You might have to declare it as global if you are inside a function

    also, you might be able to use the shortcode you wanted embedded in transposh shortcode, but that’s probably a bit trickier

    Good luck

    Thread Starter kenjidd

    (@kenjidd)

    Hi Ofer,
    thanks for answered….
    I already tried as you told me…. but it doesn’t work.
    My last shot was :

    <?php
       if($my_transposh_plugin->target_language == 'fr')
    echo do_shortcode ('[promoslider width="930px" height="350px" category="francais"]');
    else if($my_transposh_plugin->target_language == "en")
    echo do_shortcode ('[promoslider width="930px" height="350px" category="anglais"]');
    
    ?>

    But it doesn’t work. The code is ok, but nothing happen cause it doesn’t find the language.

    What is strange is that when i write the code in page.php it’s fine, but in the header.php ( as i need to do) it dosn’t work anymore.

    The only solution for the code works in the header.php, is to put this code in all the pages who call the header :

    <?php define('MY_CUR_LANG',$my_transposh_plugin->target_language); ?>

    that solution is not so good…. do you have any idea ?

    As I previously wrote, you need a global;
    use the line

    global $my_transposh_plugin

    Thread Starter kenjidd

    (@kenjidd)

    and of course to change the code in the header.php

    <?php
       if(MY_CUR_LANG == 'fr')
    echo do_shortcode ('[promoslider width="930px" height="350px" category="francais"]');
    else if(MY_CUR_LANG == "en")
    echo do_shortcode ('[promoslider width="930px" height="350px" category="anglais"]');
    
    ?>

    Thread Starter kenjidd

    (@kenjidd)

    thansk again for your REALLY QUICK answer….

    i was test with global without any success, but it’s because i made a mystake in the code…

    so you rock ! Thank you very much ! it’s work perfectly and sorry to ask you twice the same question…. it was my mystake….

    thanks ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Transposh – switch slider with $lang’ is closed to new replies.