Saturday, 21 April 2018

wordpress - PHP of custom field inside PHP Tag



I´m display a slider that get´s the images from custom field, now I need that the slider shows different images depending on the language (es - ca):



This is the code of the slider:



        





So I´m creating a conditional tag to load images depending of the language of qtranslate plugin:



                _e('









');
?>


I´m a php begginer so I see the problem maybe that the php is inside another php, because this way its not working, if i just put text between tags it works properly for the language.




Any ideas how to syntax this?


Answer



You need to check language first, using if - else



detect the language and store it to the variable named $language and then check the condition as below.



if(qtrans_getLanguage()=="es"){
?>




} else if(qtrans_getLanguage()=="ca"){
?>



}

?>

No comments:

Post a Comment

casting - Why wasn't Tobey Maguire in The Amazing Spider-Man? - Movies & TV

In the Spider-Man franchise, Tobey Maguire is an outstanding performer as a Spider-Man and also reprised his role in the sequels Spider-Man...