Uncaught TypeError: $template.get is not a function

后端 未结 8 1271
遥遥无期
遥遥无期 2020-12-24 01:28

I am getting this error in WordPress when I am using a plugin called WpBakery Visual Composer.

I am using the latest version of WordPress (4.5), using the latest Go

相关标签:
8条回答
  • 2020-12-24 02:00

    Please see my answer here.

    I fixed this bug by updating the html2element function to:

    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()
        },
    

    in /wp-content/plugins/js_composer/assets/js/backend/composer-view.js

    or in wp-content/plugins/js_composer/assets/js/dist/backend.min.js`

    Hope this works for you!

    0 讨论(0)
  • 2020-12-24 02:01

    Someone posted on the WordPress forums this solution which worked for me.

    Replace the html2element function in /wp-content/plugins/js_composer/assets/js/backend/composer-view.js with the following.

    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()
            },
    

    Edit: I had to make this replacement a second time under different circumstances, and it didn't start working until I disabled and then reenabled both the Visual Composer plugin and the Ultimate Visual Composer add-on.

    0 讨论(0)
提交回复
热议问题