需要WordPress中每种语言的dmscookie代码

时间:2018-06-22 14:32:03

标签: wordpress cookies

对于wordpress中的客户网站,我们使用的是dms cookie。由于每种语言都在不同的域中,因此我们很难让脚本显示基于该语言的dms cookie脚本。所以我想到了这样的东西:

<?php
oxides_edge_get_header();
if( ICL_LANGUAGE_CODE == 'en' ) {
echo "<script type='text/javascript' charset='UTF-8'
src='https:engscript.js'>
</script>";
} else if ( ICL_LANGUAGE_CODE == 'it' ) {
echo "<script type='text/javascript' charset='UTF-8'
src='https://itascript.js'>
</script>";
} else if ( ICL_LANGUAGE_CODE == 'de' ) {
 echo "<script type='text/javascript' charset='UTF-8'
src='https://germanscript.js'>
</script>";
} else if ( ICL_LANGUAGE_CODE == 'fr' ) {
echo "<script type='text/javascript' charset='UTF-8' 
src='https://frenchscript.js'>
</script>";
}
?>

但是它不起作用

你能告诉我怎么了吗?

1 个答案:

答案 0 :(得分:0)

尝试使用以下代码:

<?php if(ICL_LANGUAGE_CODE=='en'); ?>
<script type='text/javascript' charset='UTF-8' src='https://engscript.js'></script>
<?php elseif(ICL_LANGUAGE_CODE=='it'); ?>
<script type='text/javascript' charset='UTF-8' src='https://itascript.js'></script>
<?php elseif(ICL_LANGUAGE_CODE=='de'); ?>
<script type='text/javascript' charset='UTF-8' src='https://germanscript.js'></script>
<?php endif; ?>