Saturday, April 21, 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

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...