Is there a way to make header.php switch .css when transposh language is switched?

282 views Asked by At

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

There are 1 answers

5
dirluca On

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" />';
} 
?>