php switch shortcode
Mar 10, 2017 9:18 pm by lola123
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
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
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
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
Mar 10, 2017 10:42 pm by Edvard
Good luck.
SIMILAR TOPICS
Switch Payment method from PayPal to Mastercard | Oct 17, 2017 11:18 am | Replies: 1 | Post by: ferryto.com |
Post urls not translated if switch to different language | Aug 2, 2017 9:24 am | Replies: 4 | Post by: merovatis |
Switch languages | Aug 10, 2014 1:39 pm | Replies: 4 | Post by: vag |
Shortcode Not working. Displaying code on site | Jul 25, 2014 1:55 pm | Replies: 11 | Post by: sredfiield |
Language changes when you switch page, and more ... | May 11, 2014 8:18 am | Replies: 7 | Post by: jdesign |