The visual composer does not load and gives a TypeError: _.template (...). Trim is not a function

My visual composer plugin is not working. It is stuck on the download page. And it throws an error β€œTypeError: .template (...). Trim is not a function” Error in this line of code: this. $ Controls = $ (. Template (template, data, vc.template_options) .trim ()) addClass ('vc_controls').

Please help me fix this.

Here is the error I get:

screenshot

+14
javascript wordpress wordpress-plugin
Apr 14 '16 at 20:55
source share
10 answers

This article suggests canceling your worpress version to 4.5. http://forums.artbees.net/t/urgent-wordpress-4-5-broken-vc-backend-editor-workaround-fix-in-comments/2734

Here you can find older wp versions for installing https://wordpress.org/download/release-archive/30

I have not tried this myself, just a suggestion.

If this is still a problem for you, I resolved the same error I was getting by manually updating my theme via ftp. I downloaded the latest version of the theme because automatic updates did not work. I saved the version of Wordpress 4.5. Here are the steps I took as follows.

  • I renamed the x-update theme example after loading, named the current x-previous theme, and then changed x-update to x and deleted x-previous.
  • I updated js_composer in the same way as step 1. I downloaded the latest version of js_composer, which was related to the theme. This is updated in off-topic plugins. At this point, you can update the visual composer from the wp toolbar if it has not already been.
  • This activated vc again, but left me with some strange errors occurring in the vc_templates vc_column.php file. I had to manually comment on the fault code to clear the errors.

These three steps are a little nervous if you are not familiar with uploading files directly to your public_html directory on your site. Some topics may offer support and ftp downloads for you if you provide them with the ftp user password.

Another thing to do is clear your cache for your site. In chrome, you can clear the cache by going to chrome: // settings / cookie enter the website in the search bar and click on "Delete all clearing all locally stored data for your site." Manual updating of themes and plugins is recommended only if automatic updating is not possible, you do it. For my topic and the same exact error, I followed these really made steps https://community.theme.co/kb/updating-your-theme-and-plugins/ . However, this will vary depending on your topic. And if you are more likely to abandon your wp version, you can follow my initial suggestion. But for me, I like to have everything new and modern.

Another important note, if you have this theme, then I had to remove the x-shortcodes plugin from the plugins that manage my site, because my updated theme uses the cornerstone instead of x-shortcodes to handle important shortcodes to make vc work correctly . One more thing you need to know: none of your data should harm when loading plugins and that all data / content is stored safely in your database, and not in your subject.

0
Apr 15 '16 at 17:08
source share

If you cannot resolve this error by updating or downgrading a theme or plugin, you can at least make the following 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'); <b> s
this is. $ controls = $ (("vc.template_options") .trim ()). addClass ('vc_controls');

This will certainly work.

+17
Aug 08 '17 at 19:45
source share

Decision. Send the file / wp -content / plugins / js_composer_salient / assets / js / dist / backend.min.js around line 4045:

=======> Replace 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() }, 
+7
Apr 25 '16 at 19:49
source share

Transition to Visual Composer version 4.11.2 +

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

+6
Apr 18 '16 at 9:25
source share

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

Change this:

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

Wherein:

 this.$controls=$(("vc.template_options").trim()).addClass("vc_controls"); 
+1
Jan 30 '18 at 8:12
source share

I had problems 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 reluctantly updated, as there might be an error. (But it is a fact that the update fixes the error)

Since the upgrade to version 6.0.3 was not successful.

Decision:

My restored a backup of the entire site.

Tip: Never Forget Back Up.

+1
Jun 17 '19 at 7:50
source share

I tried the following solutions:

  • maulik (but there weren’t such files in my plugins folder - frontend_editor.js and custom_views.js, just the "vendors" folder in "/ wp-content / plugins / js_composer / assets / js / frontend_editor"),

  • Amritosh Pandey solution (does not work even after clearing the cache and history),

  • Berein's solution (also does not work).

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

Amritoshpandey code should be inserted in /wp-content/plugins/js_composer/assets/js/dist/backend.min.js instead:

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},

0
Apr 26 '18 at 10:29
source share

If you have Visual Composer 4.9 , just replace these 2 files from the archive - frontend-editor.min.js - backend.min.js

path: /wp-content/plugins/js_composer/assets/js/dist

Remember to back up your files.

https://yadi.sk/d/JH4cbtnH3UoU3F

click "download add" (tested with VC 4.9 and WP 4.9.5)

0
Apr 26 '18 at 12:30
source share

You should try to fix this by raising / lowering your theme / plugin. But if you, like me, cannot solve this problem this way, and you just need to quickly crack this problem, the following helped 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 one line in each of them by adding () . Edit:

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

so that:

 this.$controls = $( _.template( template, data, vc.template_options )().trim() ).addClass( 'vc_controls' ); 
-one
Apr 24 '19 at 17:09 on
source share

1.Please disable the plugin. 2. Delete all files from the plugin folder (js_composer folder) 3.Download the latest version of Visual Composer 4. Add a new plugin β†’ and select the downloaded plugin β†’ Download ---> Activate

-3
Apr 18 '16 at 12:56 on
source share



All Articles