My hosting provider automatically upgraded to 4.5, and this led to an error with the Visual Composer plugin.
I READ THESE MAILS: The plugin throws a TypeError after updating Wordpress 4.5
The visual composer does not load and gives a TypeError: _.template (...). trim is not a function
Uncaught TypeError: $ template.get is not a function
And replaced the html2element function with the one provided. However, as many people commented on these posts, I get a new error:
composer-view.js?ver=4.6.1:139 Uncaught TypeError: Cannot read property 'attributes' of undefined
Here is my function:
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() },
The error seems to come from this line:
$template.get(0).attributes
Has anyone figured out how to fix this?
thanks for the help
javascript jquery wordpress
Graham Slick May 7 '16 at 15:55 2016-05-07 15:55
source share