Forum Archive - php switch shortcode

php switch shortcode
Mar 10, 2017 9:18 pm by lola123
Hi i need to switch some content via php from english to french. code works on english, but when i switch to french it still shows the english version. here is my code: <?php if (gt_lang ["en"]) { echo do_shortcode('[wd-test alias="clocksli"]'); } elseif (gt_lang ["fr"]) { echo do_shortcode('[wd-test alias="clocksli-french"]'); } ?>
Re: php switch shortcode
Mar 10, 2017 9:40 pm by Edvard
Hi, If you are using the paid version it can be this: <?php if (!isset($_SERVER['HTTP_X_GT_LANG'])) { // default language echo do_shortcode('[wd-test alias="clocksli"]'); } elseif ($_SERVER['HTTP_X_GT_LANG'] == 'fr') { echo do_shortcode('[wd-test alias="clocksli-french"]'); } elseif ($_SERVER['HTTP_X_GT_LANG'] == 'en') { echo do_shortcode('[wd-test alias="clocksli-english"]'); } ?> Thanks!
Re: php switch shortcode
Mar 10, 2017 9:48 pm by lola123
I'm using the free version.
Re: php switch shortcode
Mar 10, 2017 10:32 pm by lola123
NO PROBLEM, I DECIDED TO CHAMGE FOR A BETTER PLUGIN THAT WORKS PERFECT FOR FREE: QTRANSLATE, WAYYY BETTER
Re: php switch shortcode
Mar 10, 2017 10:42 pm by Edvard
Good luck.

SIMILAR TOPICS

Switch Payment method from PayPal to MastercardOct 17, 2017 11:18 amReplies: 1Post by: ferryto.com
Post urls not translated if switch to different languageAug 2, 2017 9:24 amReplies: 4Post by: merovatis
Switch languagesAug 10, 2014 1:39 pmReplies: 4Post by: vag
Shortcode Not working. Displaying code on siteJul 25, 2014 1:55 pmReplies: 11Post by: sredfiield
Language changes when you switch page, and more ...May 11, 2014 8:18 amReplies: 7Post by: jdesign

Try GTranslate with a free 15 day trial