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 code: this.$controls = $(.template(template, data, vc.template_options).trim()).addClass('vc_controls');
Please help me to fix this out.
Here is the error which I get:
Re-Save your page can fix Visual Composer issues First thing to try is top simply go to your page in the backend and re-save your page by clicking the “update” button. Then try the Visual Composer builder again and see if it’s working. 2. Make sure your theme and plugin is up to date
Check your Settings If you aren’t seeing all the available Visual Composer Modules please go to Visual Composer > Role Manager and double check that they are all enabled for your specific admin roles. If you aren’t sure how to do that please view our Video Guide. 6. Front-End Editor Not Working?
If your site and WordPress URL’s aren’t the same it can cause issues with the Front-End not working on the visual composer, so please make sure they are the same. You would check this at Settings / General. Why is this the case?
In the newer versions of Plesk there is a WordPress Toolkit which has some great options, however, if not setup correctly it could cause the Visual Composer from not working in the Front-End editor. So if you are using these functions, please double check to make sure they aren’t the cause of your problems. 9.
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.
Solution Goto file /wp-content/plugins/js_composer_salient/assets/js/dist/backend.min.js around line 4045:
======> Replace the code
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()
},
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With