roy*_*asa 39 javascript wordpress jquery
当我使用名为WpBakery Visual Composer的插件时,我在WordPress中收到此错误.
我正在使用最新版本的WordPress(4.5),使用最新的谷歌Chrome版本,所有插件都会更新.我似乎无法使用Visual Composer添加任何元素或模板.
有人可以帮助我或告诉我可能会发生什么以及如何解决此错误.
我得到的错误:
Ben*_*Ben 101
我通过更新html2element
函数来修复此错误:
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()
},
Run Code Online (Sandbox Code Playgroud)
在 /wp-content/plugins/js_composer/assets/js/backend/composer-view.js
或者在wp-content/plugins/js_composer/assets/js/dist/backend.min.js中
希望这对你有用!
Ren*_*Mtl 21
@Sorin Haidau
大家好,我正在使用Astra主题.此修复程序的工作率为99.9%.对于某些人来说,这只会停止旋转轮,但一旦页面加载,视觉作曲家就不会.
我对这段代码稍作修改(现在到处都是)
原创Astra主题代码在这里(composer-view.js)
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();
},
Run Code Online (Sandbox Code Playgroud)
有效的代码:
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()
},
Run Code Online (Sandbox Code Playgroud)
主要区别在于此处(与原始代码相比)
}); this.$el.attr
Run Code Online (Sandbox Code Playgroud)
有一个分号而不是原始的逗号:):
}), this.$el.attr
Run Code Online (Sandbox Code Playgroud)
干杯人:)
更新:这修复了我使用主题astra的20个网站中的19个,其中包含与上述相同的错误...除了一个网站之外的所有网站.
视觉作曲家终于出现后我有这个错误(缺少一半的设计元素)
Uncaught Error: Syntax error, unrecognized expression: .ui-tabs-nav [href=#tab-1415196282-1-8]
Run Code Online (Sandbox Code Playgroud)
我通过更新composer-custom-views.js的第552行来解决这个问题:
$('.ui-tabs-nav [href="#tab-' + params.tab_id + '"]').text(params.title);
Run Code Online (Sandbox Code Playgroud)
而且现在一切都有效.对不起,如果它不适用于所有主题,请尝试使用上面其他人提到的代码.如果这不起作用尝试我的解决方案:)
Elo*_*ito 16
有人在WordPress论坛上发布了这个对我有用的解决方案.
用以下内容替换该html2element
功能/wp-content/plugins/js_composer/assets/js/backend/composer-view.js
.
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()
},
Run Code Online (Sandbox Code Playgroud)
编辑:我不得不在不同的情况下第二次进行此替换,并且在我禁用然后重新启用Visual Composer插件和 Ultimate Visual Composer 插件之后它才开始工作.
归档时间: |
|
查看次数: |
47347 次 |
最近记录: |