我见过https://stackoverflow.com/a/21276169/848513
但我无法弄清楚如何设置ACF以允许图像映射。
我的代码是:
<img alt="Map" src="sample.jpg" useMap=#Map border=0>
<map name="Map">
<area shape="rect" coords="118,32,234,127" href="article.php?id=155" target="list" alt="North">
<area shape="rect" coords="179,136,299,191" href="article.php?id=156" target="list" alt="East">
<area shape="rect" coords="17,141,113,223" href="article.php?id=157" target="list" alt="Central">
</map>
当我在config.js
文件中使用以下代码时:
config.allowedContent = 'map area';
- 粘贴之后我在编辑器中得到的是:
<p><map><area /> <area /> <area /> <area /></map></p>
有人可以帮我们使用我需要的确切代码吗?
由于
答案 0 :(得分:1)
ACF正在按照你所说的去做: 仅允许地图和区域标记,但不允许其属性。
您需要指定允许的属性:
config.allowedContent =
'area[!shape,!coords,!href,!target,alt];' +
'map[!name];';
仔细阅读文档:
答案 1 :(得分:1)
Giammin的答案几乎是正确的,问题是它使用的是config.allowedContent选项,而不是更合适的config.extraAllowedContent选项,基本上会覆盖您的内容过滤器设置而不是扩展。
因此,这会将ACF变为custom mode,而不是调整automatic mode。
请尝试以下方法:
config.extraAllowedContent =
'area[!shape,!coords,!href,!target,alt];' +
'map[!name];';