php switch shortcode

Popular automatic website translation tool

php switch shortcode

Postby lola123 » Sat Mar 11, 2017 1:18 am

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"]'); }
?>
lola123
 
Posts: 3
Joined: Sat Mar 11, 2017 1:15 am

Re: php switch shortcode

Postby Edvard » Sat Mar 11, 2017 1:40 am

Hi,

If you are using the paid version it can be this:

Code: Select all
<?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!
Regards,

Edvard Ananyan - GTranslate Team

Please leave your feedback on your CMS plugin directory. It is very important for us!
Google Translate Joomla
Google Translate WordPress
Google Translate Drupal
Edvard
Site Admin
 
Posts: 4403
Joined: Mon Jun 28, 2010 1:54 pm
Location: Yerevan, Armenia

Re: php switch shortcode

Postby lola123 » Sat Mar 11, 2017 1:48 am

I'm using the free version.
lola123
 
Posts: 3
Joined: Sat Mar 11, 2017 1:15 am

Re: php switch shortcode

Postby lola123 » Sat Mar 11, 2017 2:32 am

NO PROBLEM, I DECIDED TO CHAMGE FOR A BETTER PLUGIN THAT WORKS PERFECT FOR FREE: QTRANSLATE, WAYYY BETTER
lola123
 
Posts: 3
Joined: Sat Mar 11, 2017 1:15 am

Re: php switch shortcode

Postby Edvard » Sat Mar 11, 2017 2:42 am

Good luck.
Regards,

Edvard Ananyan - GTranslate Team

Please leave your feedback on your CMS plugin directory. It is very important for us!
Google Translate Joomla
Google Translate WordPress
Google Translate Drupal
Edvard
Site Admin
 
Posts: 4403
Joined: Mon Jun 28, 2010 1:54 pm
Location: Yerevan, Armenia


  • Related Topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 2 guests