Support » Fixing WordPress » Visual Composer is not working

  • Resolved hwang74

    (@hwang74)


    The Visual Composer stuck at the loading page at frontend editor and also the backend editor is not working with the circle keeps running.

    I did all the master post tells but it’s still not working.

    Chrome debugging shows:

    Uncaught TypeError: _.template(…).trim is not a function
    custom_views.js:101

    window.InlineShortcodeViewContainer.window.InlineShortcodeView.extend.addControls @ custom_views.js:101
    window.InlineShortcodeView.vc.shortcode_view.Backbone.View.extend.render @ frontend_editor.js:382
    window.InlineShortcodeViewContainer.window.InlineShortcodeView.extend.render @ custom_views.js:54
    window.InlineShortcodeView_vc_column.window.InlineShortcodeViewContainerWithParent.extend.render @ custom_views.js:342
    vc.ShortcodesBuilder.renderShortcode @ shortcodes_builder.js:191
    vc.ShortcodesBuilder._renderBlockCallback @ shortcodes_builder.js:161
    (anonymous function) @ shortcodes_builder.js:95
    (anonymous function) @ load-scripts.php:87
    m.each.m.forEach @ load-scripts.php:87
    vc.ShortcodesBuilder.buildFromContent @ shortcodes_builder.js:82
    vc.build @ build.js:65
    (anonymous function) @ vc_page_editable.js:271
    i @ jquery.js:2
    j.fireWith @ jquery.js:2
    n.extend.ready @ jquery.js:2
    K

    I need help and thank you in advance!!

Viewing 15 replies - 1 through 15 (of 18 total)
  • I’m having the same problem. Please help!!

    lisa

    (@contentiskey)

    Same problem here, I’ve taken all the steps mentioned online, cleared out all caches (on WordPress, browser, and Cloudflare), disabled all plugins, switched themes, yet literally nothing is working.

    WP Bakery Visual Composer is a premium plugin not supported in these forums. Contact the plugin developers for a plugin update.

    Unfortunately, Visual Composer was included in a theme I bought. Because I didn’t buy it directly from WP Bakery, they won’t provide any support, but the theme developers won’t help either because they just keep telling me to contact the plugin developers… Rock and a hard place here.

    Visual Composer is only $34.

    Sure, but that’s $34 that I shouldn’t have to spend. The price of the theme included full use of a functioning Visual Composer, which has suddenly stopped working for no apparent reason. A customer shouldn’t have to pay again for something that was already (supposedly) included in the original purchase.

    A customer shouldn’t have to pay again for something that was already (supposedly) included in the original purchase.

    Take that up with the theme developer. We do not support premium/paid themes or plugins here. We don’t allow premium/paid developers to support their products here.

    I manually updated the theme so after then I was able to update the visual composer to its newest version. Now it works fine.

    The theme developer should not leave the clients with a broken plugin. It’s forced sales.
    I found a crappy solution.
    You just remove the plugin from your website, change the theme, go back to the one you want and it will suggest that you download the plugin again (hence the latest version).
    Crappy solution because you lose all the presets, etc.

    But I guess you could have another local installation of the same website installed just for this purpose and keep replacing only the plugin’s files when needed.

    Still a bit edgy.

    I was able to resolve the issue. Turns out I was using an older version of JS composer. Updating to the newest version broke my site so I tracked down the error and updated the html2element function to

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

    in /wp-content/plugins/js_composer/assets/js/backend/composer-view.js

    Hi. I tried the code provide and it fixed the not loading issue. However now the Single Image block isn’t working correctly. If I pick an image and save the block, no image is displayed. Anyone having the same issue?

    Cheers
    Stu

    html2element function fix solves the backend code issue.

    However you still have a problem with js_composer/assets/js/frontend/ files.

    However if you open up the frontend editor you’ll have this “trim” issue on custom_views.js:101 , and line 467 of another file. I forgot the name, but I think it may be frontend_editor.js.

    Example code is from custom_views and may be slightly different in the other file, just apply explained fix for trim.

    Bad code:

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

    Fixed code:

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

    As you can see, since _.template is a function which returns html as a string, you need to call it as a function, turning it into a string, before trying to execute trim on it.

    Hope this was helpful, cheers.

    It works for me. Thank you a lot.

    Visual Composer 4.7 + WordPress 4.5.2

    Thanks so much. I was about to try to code around it myself and a search brought me here. Kudos!

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘Visual Composer is not working’ is closed to new replies.