Uncaught TypeError: $template.get is not a function

后端 未结 8 1292
遥遥无期
遥遥无期 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 01:46

    for anyone comes here from google search: after change html2element function if you have this error Cannot read property 'attributes' update render: function to below code

    render: function () {
            var $shortcode_template_el = $( '#vc_shortcode-template-' + this.model.get( 'shortcode' ) );
            if ( $shortcode_template_el.is( 'script' ) ) {
                var newHtmlCode =  _.template( $shortcode_template_el.html(),
                                                this.model.toJSON(),
                                                vc.templateOptions.default );
                if(!_.isString(newHtmlCode)){
                    newHtmlCode = $shortcode_template_el.html();
                }
                this.html2element( newHtmlCode );
            } else {
                var params = this.model.get( 'params' );
                $.ajax( {
                    type: 'POST',
                    url: window.ajaxurl,
                    data: {
                        action: 'wpb_get_element_backend_html',
                        data_element: this.model.get( 'shortcode' ),
                        data_width: _.isUndefined( params.width ) ? '1/1' : params.width,
                        _vcnonce: window.vcAdminNonce
                    },
                    dataType: 'html',
                    context: this
                } ).done( function ( html ) {
                    this.html2element( html );
                } );
            }
            this.model.view = this;
            this.$controls_buttons = this.$el.find( '.vc_controls > :first' );
            return this;
        },
    

提交回复
热议问题