Sau đây dịch vụ thiết kế web wordpress sẽ hướng dẫn bạn cách fix lỗi plugin js compose khi nâng câp phiển bản wordpress 4.5 mới nhất , mà bạn gặp phải.
Để sửa lỗi bản chỉ cần làm theo bước sau :
mở thu mục plguin /js_composer/assets/js/backend/composer-view.js
tìm tới hàm
[crayon]/**
* Convert html into correct element
* @param html
*/
html2element:function (html) {
var attributes = {},
$template;
if (_.isString(html)) {
this.template = _.template(html);
$template = $(this.template(this.model.toJSON()).trim());
} else {
this.template = html;
$template = html;
}
_.each($template.get(0).attributes, function (attr) {
attributes[attr.name] = attr.value;
});
this.$el.attr(attributes).html($template.html());
this.setContent();
this.renderContent();
},
Thay code dòng hàm đó bằng dòng code sau:
[crayon]html2element: function(html) {
var $template, attributes = {},
template = html;
$template = $(template(this.model.toJSON()).trim()), _.each($template.get(0).attributes, function(attr) {
attributes[attr.name] = attr.value
}), this.$el.attr(attributes).html($template.html()), this.setContent(), this.renderContent()
},