WordPress编辑器删除div属性 [英] WordPress Editor removing div attributes

查看:76
本文介绍了WordPress编辑器删除div属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在帮助一个即将举行的海洋会议的wordpress网站。我正在处理的一件事是用于交互式平台页面。它使用css& JavaScript的。我注意到每个我放入的div标签,它会继续删除一些属性。例如...



我输入:

 < div id =booth107
class =booth booth_20x10bronze
data-name =Fluval
data-link =http://www.fluvalaquatics.com/
data-logo =http://piscespets.com/wp-content/uploads/fluval-logo.jpg
>& nbsp;< / div>

它出来了:

 < div id =booth107class =booth_20x10bronze>& nbsp;< / div> 

我在文本模式下进行编辑,而不是可视化,而且我不会来回翻转。 p>

任何人都知道为什么我可能会丢失一些div属性?

解决方案

尝试在你的functions.php中添加这段代码来覆盖乱码html代码。



$ p $ function override_tinymce_option($ initArray){
$ opts ='* [*]';
$ initArray ['valid_elements'] = $ opts;
$ initArray ['extended_valid_elements'] = $ opts;
返回$ initArray;
}
add_filter('tiny_mce_before_init','override_tinymce_option');


I am helping out with a wordpress site for an upcoming marine conference. One of the things I am working on is for an interactive platform page. It uses a combination of css & javascript. I am noticing for each of the div tags I am putting in, it keeps on removing some of the attributes. For example...

I put in:

<div id="booth107"
          class="booth booth_20x10bronze"
          data-name="Fluval"
          data-link="http://www.fluvalaquatics.com/"
          data-logo="http://piscespets.com/wp-content/uploads/fluval-logo.jpg"
>&nbsp;</div>

and it comes out:

<div id="booth107" class="booth booth_20x10bronze">&nbsp;</div>

I am editing in text mode, not visual, and I am not flipping back and forth.

Anyone know why I might be losing some of my div attributes?

解决方案

Try to add this code in your functions.php to override the messing up html code.

function override_tinymce_option($initArray) {
    $opts = '*[*]';
    $initArray['valid_elements'] = $opts;
    $initArray['extended_valid_elements'] = $opts;
    return $initArray;
}
add_filter('tiny_mce_before_init', 'override_tinymce_option');

这篇关于WordPress编辑器删除div属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆