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

前端 未结 11 1566
孤街浪徒
孤街浪徒 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:31

    You should try to fix this by up/downgrading your theme/plugin. But if you, like me, can't solve it this way and just need to do a quick hack to get past this particular problem, the following worked for me.

    Edit the following two files:

    wp-content\plugins\js_composer\assets\js\frontend_editor\frontend_editor.js
    wp-content\plugins\js_composer\assets\js\frontend_editor\custom_views.js
    

    Change a single line in each of them, adding (). Change:

    this.$controls = $( _.template( template, data, vc.template_options ).trim() ).addClass( 'vc_controls' );
    

    to:

    this.$controls = $( _.template( template, data, vc.template_options )().trim() ).addClass( 'vc_controls' );
    

提交回复
热议问题