【问题标题】:Visual Composer giving ReferenceError: id is not defined error when adding an imageVisual Composer 在添加图像时给出 ReferenceError: id is not defined 错误
【发布时间】:2016-10-08 15:44:36
【问题描述】:

我被要求调查一个不是我制作的 WordPress 页面上的问题。它使用 Visual Composer,并且有几天他们无法在后端的页面中添加任何图像。 Single Image 组件加载后,您可以选择图片,但添加时没有任何反应。

检查控制台会出现以下错误:

ReferenceError: id is not defined

在以下位置:/wp-admin/load-scripts.php?c=0&load%5B%5D=jquery-core,jquery-migrate,utils,jquery-ui-core,jquery-ui-widget,jquery -ui-mouse,jquery-ui-draggable,jquery-ui-slider,jquery-tou&load%5B%5D=ch-punch,iris,wp-color-picker,jquery-ui-sortable,下划线,wp-a11y,thickbox ,简码,plupload,jquery-ui-position,jquery-ui-men&load%5B%5D=u,jquery-ui-autocomplete,jquery-ui-tabs,farbtastic,media-upload&ver=4.5.2 line 98 > Function

var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};
with(obj||{}){
__p+='\n    <li class="added">\n        <div class="inner" style="width: 75px; height: 75px; overflow: hidden;text-align: center;">\n            <img rel="'+
((__t=( id ))==null?'':__t)+
'" src="'+
((__t=( url ))==null?'':__t)+
'" />\n        </div>\n        <a href="#" class="icon-remove"></a>\n    </li>\n';
}
return __p;

试图通过这个、这个、这个和这个解决方案来修复它,但没有任何效果。

【问题讨论】:

    标签: wordpress visual-composer


    【解决方案1】:

    我今天遇到了这个错误。它是由更新到 wordpress 4.5 引起的,其中包括一个新版本的 jquery,它与这个旧版本的视觉作曲家不兼容。

    我可以通过更新到更新版本的视觉作曲家来解决这个问题,我从这个答案中找到了它:https://stackoverflow.com/a/37138448

    【讨论】:

    • 感谢您的快速回复。我下载了新版本的视觉作曲家,上传到主题的插件文件夹,但现在它给出了一个白屏死机。在 php 日志中显示以下错误:Jun 9 13:28:44 PHP Fatal error: Call to a member function init() on a non-object in /public_html/wp-content/themes/123medicine/functions.php on第 161 行 functions.php 中的第 160-161 行是 require_once locate_template('/wpbakery/js_composer/js_composer.php'); $wpVC_setup->init($composer_settings);我想我需要以其他方式进行初始化,但是如何?
    • 对于我的主题,我可以简单地删除 wp-content/plugins/js_composer 目录并解压缩替换。我不确定它是如何被我的主题初始化的,但我不需要做任何额外的事情。听起来您的主题已经嵌入了视觉作曲家,而不是存在于插件目录中。您可能想阅读以下内容:canatech.ca/kb/wp/kb-wordpress-registering-visual-composer
    • 是的,Visual Composer 已经内置。我检查了 function.php,在那里我得到了完全相同的初始化代码。
    【解决方案2】:

    今天我和一位朋友也遇到了同样的问题,她在 wordpress 中创建了自己的网站,更新了 wordpress 并停止工作 Visual Composer。 为了快速解决问题,我修改了 media-editor.js 文件,第 144 行(media.VcSingleImage,设置函数) 我已经替换了这一行:

    this.$img_ul.html(_.template($('#vc_settings-image-block').html(), selection));

    this.$img_ul.html("&lt;li class='add ui-sortable-handle'&gt;&lt;img rel='"+selection.id+"' src='"+selection.url+"' &gt; &lt;a href='#' class='icon-remove'&gt;&lt;/a&gt; &lt;/li&gt;");

    让我们提一下,Visual Composer 的版本是:4.7.4

    【讨论】:

      【解决方案3】:

      我的朋友遇到了同样的问题,但为突出主题定制了视觉作曲家。我创建了完整的 wp 备份,启用了默认主题,删除了突出主题,下载了带有原始主题的 zip 文件(从他购买的 themeforest.net)并将其上传到 外观/主题/添加新/上传主题 在 Plugins 区域查看并启用 Salient Visual Composer 插件...

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2021-03-29
        • 2023-03-04
        • 2021-07-12
        • 2020-01-13
        • 2021-01-16
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多