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

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

    If you are unable to solve this error by upgrading or downgrading your theme or plugin, you could at least make the below changes.

    1. Open 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
    

    2. Replace

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

    with

    this.$controls = $( ( "vc.template_options" ).trim() ).addClass( 'vc_controls' );
    

    This will surely work.

    0 讨论(0)
  • 2021-02-05 11:44

    Upgrade to Visual Composer version 4.11.2+

    Note Wordpress 4.5 compatibility was fixed on 13th April: https://wpbakery.atlassian.net/wiki/display/VC/Release+Notes

    0 讨论(0)
  • 2021-02-05 11:45

    As Shady sherif said at Maulik's suggestion, this is what I've changed in 2 places at frontend-editor.min.js and it worked!! Thanks to you both!

    Change this:

    this.$controls=$(_.template(template,data,_.extend({},vc.template_options,{ evaluate:/\{#([\s\S]+?)#}/g})).trim()).addClass("vc_controls");  
    

    With this:

    this.$controls=$(("vc.template_options").trim()).addClass("vc_controls");
    
    0 讨论(0)
  • 2021-02-05 11:46

    UPDATE: in current updates none of this is needed just replace the plugin






    I had problem with WPBakery Page Builder in version 6.0.2.
    Wordpress: Version 5.2.1

    ERROR: Uncaught TypeError: window.vc.frame_window.jQuery is not a function at window.vc.ShortcodesBuilder.buildFromContent (frontend-editor.min.js? Ver = 6.0.2: 10)
         at Object.vc.build (frontend-editor.min.js? ver = 6.0.2: 10)
         at frontend-editor.min.js? ver = 6.0.2: 10
    

    I was reluctant to upgrade, as there might be a bug. (But it is a fact that an update is bug fix)

    Since the update to version 6.0.3 was not successful.

    Solution:

    Mine was restoring the backup of the whole site.

    Tip: Never forget Backup.

    0 讨论(0)
  • 2021-02-05 11:47

    I used version 4.10 and upload the file assets/js/frontend-editor.min.js to the same file in 4.12 version.

    Note: I keep my version and update only this file. I things this issues risen after update my php version, but i dont sure about that.

    That`s work fine.

    I get this file here: https://www.downloadfreethemes.io/visual-composer-v5-0-1-page-builder-for-wordpress/

    • I have theme license.
    0 讨论(0)
提交回复
热议问题