在我安装了Dokan Pro插件之后,新帖子和新产品上的编辑器工具出现了问题。这是文件Dokan tmc按钮。有问题的js
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);
});
SO网友:Kpax7
这是dokan插件的问题。将下面的代码添加到“functions.php”(在主题目录中)将暂时解决此问题(我希望他们在新版本中修复此冲突):
function dk_shortcode_script($shortcodes){
define(\'DOKAN_SHORTCODES\', $shortcodes);
?>
<script>
var dokan_assets_url = <?php echo json_encode( DOKAN_PRO_PLUGIN_ASSEST ) ?>;
var dokan_shortcodes = <?php echo json_encode( DOKAN_SHORTCODES ) ?>;
</script>
<?php
return $shortcodes;
}
add_filter(\'dokan_button_shortcodes\', \'dk_shortcode_script\', 10, 1);
add_action(\'admin_head\', \'dk_shortcode_script\');
代码由Ahamed Arshad(@achchu93)在插件支持论坛上编写。