1

i am using transposh to translate my website from English to Arabic but when i switch language to Arabic it switches the style.css and it reverse the layout of my website leading to a mess, so i made a new style.css which works with the Arabic version very well but now i don't know how to link them together i mean i want to know how to make it switch the css file when it switches the language. i tried this code but it didn't work

<?php if(MY_CUR_LANG == 'en'){?>
<link rel="stylesheet" href="http://localhost/wordpress/wp-content/themes/style.css" type="text/css" media="screen" />
<?php }elseif(MY_CUR_LANG == 'ar'){?>
<link rel="stylesheet" href="http://localhost/wordpress/wp-content/themes/arabic.css" type="text/css" media="screen" />
<?php } ?>

1 Answers1

0

You cannot jump in and out php code. Try

<?php 
if(MY_CUR_LANG == 'en'){
     echo'<link rel="stylesheet" href="http://localhost/wordpress/wp-content/themes/style.css" type="text/css" media="screen" />';
}elseif(MY_CUR_LANG == 'ar'){
     echo'<link rel="stylesheet" href="http://localhost/wordpress/wp-content/themes/arabic.css" type="text/css" media="screen" />';
} 
?>
dirluca
  • 423
  • 3
  • 12
  • can you give us some more information about not working? Does PHP give error messages? How HTML is different from what you expect? – dirluca Dec 17 '14 at 11:15
  • i copied the code to header.php and when i switch language using Transposh the "ar" stylesheet doesn't work instead of the "en" stylesheet – Ahmed Seif El Din Dec 17 '14 at 16:16
  • I'm still lost. What's MY_CUR_LANG value? Try `` What does it write on screen? Is the value of MY_CUR_LANG which is wrong (then I would suggest to write to transposh support forum) or your own code? – dirluca Dec 17 '14 at 16:42
  • MY_CUR_LANG it self isn't the right thing that i should write there i just need something to call if transposh plugin is switched to Arabic hence it changes the style i was just giving an example of what i tried. – Ahmed Seif El Din Dec 20 '14 at 11:05
  • So if I understand correctly what you need is to understand which variable you have to fetch from transposh (and how) to define which is the language is set in transposh. I would definitely ask to the transposh forum – dirluca Dec 23 '14 at 10:31