Visual composer doesn't load and gives TypeError: _.template(…).trim is not a function

前端 未结 11 1411
孤街浪徒
孤街浪徒 2021-02-05 11:07

My visual composer plugin doesn\'t work. It stuck on the loading page. And it gives an error \"TypeError: .template(...).trim is not a function\" Error is on this line of co

11条回答
  •  时光取名叫无心
    2021-02-05 11:23

    I tried the following solutions:

    • maulik`s (but there was no such files on my plugin folder - frontend_editor.js and custom_views.js, just a "vendors" folder on "/wp-content/plugins/js_composer/assets/js/frontend_editor"),

    • Amritosh pandey`s solution (does not work even after cache & history cleaning),

    • Berein`s solution (does not work too).

    I solved the problem by using a Amritoshpandey's solution: https://gist.github.com/levantoan/519bb0d42c9f7bd6c4d78ef1686bb848 ("The following code has completely corrected my problems, I can load the page, add, clone, remove, etc")

    The Amritoshpandey's code should be pasted in /wp-content/plugins/js_composer/assets/js/dist/backend.min.js instead of:

    render:function(){var $shortcode_template_el=$("#vc_shortcode-template-"+this.model.get("shortcode"));if($shortcode_template_el.is("script"))this.html2element(_.template($shortcode_template_el.html(),this.model.toJSON(),vc.templateOptions["default"]));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)})}return this.model.view=this,this.$controls_buttons=this.$el.find(".vc_controls > :first"),this},

提交回复
热议问题