我正在使用 WordPress 的 HTML 导入插件导入 HTML 页面。
我有一个谷歌地图的代码片段,它是导入的。
但是,导入后,它会包含script
tag in CDATA
。如果我删除 CDATA,地图就可以正常工作。如何阻止 WordPress 将脚本包含在 CDATA 中?
这是脚本:
<script type="text/javascript">
<[[CDATA[
var locations = [ ['<strong>Alabama', 33.606379, -86.50249, 1] ];
var map = new google.maps.Map(document.getElementById("map"), {
zoom: 5,
center: new google.maps.LatLng(33.606379, -86.50249),
mapTypeId: google.maps.MapTypeId.ROADMAP
});
var infowindow = new google.maps.InfoWindow();
var marker, i;
for (i = 0; i < locations.length; i++) {
marker = new google.maps.Marker({
position: new google.maps.LatLng(locations[i][1], locations[i][2]),
map: map
});
google.maps.event.addListener(marker, click, (function(marker, i) {
return function() {
infowindow.setContent(locations[i][0]);
infowindow.open(map, marker);
}
})(marker, i));
}
]]>;
</script>
$content = str_replace(']]>', ']]>', $content);
wp-includes\post-template.php 第 167 行
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)