我正在使用 jQuery UI 自动完成功能:
<script charset="UTF-8">
$(function() {
var availableZtour = [<?php query_posts('category_name=AAAA&showposts=5&orderby=date'); if (have_posts()) { while (have_posts()) { the_post(); ?>"<?php echo the_title(); ?>",<?php }} wp_reset_query(); ?>];
$( "#ztour" ).autocomplete({
source: availableZtour
});
});
</script>
在 HTML 中,这与:
var availableZtour = ["Cycling & Cooking","Snorkeling & Tour",];
但这在浏览器中显示为:
Cycling & Cooking or Snorkeling & Tour
我正在使用 remove_filter ('the_title', 'wptexturize');
,但这不适用于 &
如何让代码回显 &
而不是 &
?
最佳答案
使用html_entity_decode
,或修复自动完成插件以正确处理 HTML 实体。
关于javascript - Wordpress jQuery 错误 &,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23009857/