我正在编写一个 404 自定义页面,一切都很好,但我正在使用 WPML,因此我正在本地化我的字符串。
这是我的代码的一部分:
<h4><?php _e('You still can\'t find anything?', 'kslang'); ?></h4>
<h5><?php _e('Well, then you probably should give us a wake up call...', 'kslang'); "\n"?></h5>
<h5><?php _e('but be aware who you\'re waking up!', 'kslang');?></h5>
<h5><?php _e('You\'re sure? Well, then...', 'kslang'); ?></h5>
<form>
<input type="button" value="<?php _e('Contact Us!', 'kslang'); ?>" onClick="window.location.href='http://example.com/contact-us-today'">
</form>
<h5><?php _e('or try the Site Map Below. You\'re also welcome to check out our related projects!', 'kslang'); ?></h5>
现在的问题是,我的
"window.location.href='http://example.com/contact-us-today'"
没有重定向到相关语言。
我虽然可以简单地将 href 链接包装在获取文本中,例如通过按钮文本和其余字符串。
这不行,显然事情要复杂得多。我需要使用 if/else 语句吗?
有人知道如何重定向到正确的语言吗?(我尝试使用 _e 来翻译字符串翻译器中的 href 链接,但这不适用于 _e,因为在这种情况下插入 php 片段会破坏我的网站)
希望有人可以提供意见...