首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ReferenceError:未定义dokan_assets_url

ReferenceError:未定义dokan_assets_url
EN

WordPress Development用户
提问于 2018-05-05 11:39:14
回答 1查看 224关注 0票数 0

在我安装了Dokan插件之后,新帖子和新产品上的编辑器工具出现了问题,这是dokan-tmc-keyon.js文件中的问题。

代码语言:javascript
复制
jQuery(document).ready(function($) {

    tinymce.create('tinymce.plugins.dokan_button', {
        init : function(editor, url) {
                var menuItem = [];
                var ds_img = dokan_assets_url +'/images/D.png';
                $.each( dokan_shortcodes, function( i, val ){
                    var tempObj = {
                            text : val.title,
                            onclick: function() {
                                editor.insertContent(val.content)
                            }
                        };

                    menuItem.push( tempObj );
                } );
                // Register buttons - trigger above command when clickeditor
                editor.addButton('dokan_button', {
                    title : 'Dokan shortcodes', 
                    classes : 'dokan-ss',
                    type  : 'menubutton',
//                    text  : 'Dokan',
//                    image : dokan_assets_url +'/images/D.png',
                    menu  : menuItem,
                    style : ' background-size : 18px; background-repeat : no-repeat; background-image: url( '+ ds_img +' );'
                });
        },   
    });

    // Register our TinyMCE plugin

    tinymce.PluginManager.add('dokan_button', tinymce.plugins.dokan_button);
});
EN

回答 1

WordPress Development用户

发布于 2018-05-26 23:17:43

这是杜坎插件的问题。将下面的代码添加到"functions.php“中(在主题目录中)将暂时解决这个问题(我希望它们在较新的版本中解决这个冲突):

代码语言:javascript
复制
function dk_shortcode_script($shortcodes){

    define('DOKAN_SHORTCODES', $shortcodes);

    ?>
    
        var dokan_assets_url = <?php echo json_encode( DOKAN_PRO_PLUGIN_ASSEST ) ?>;
        var dokan_shortcodes = <?php echo json_encode( DOKAN_SHORTCODES ) ?>;

代码是由Ahamed (@achchu93)在插件支持论坛上编写的。

票数 0
EN
页面原文内容由WordPress Development提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://wordpress.stackexchange.com/questions/302748

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档