2
我有shorcodes这个WordPress插件。我正尝试实现这在我的主题,而不需要安装它。我怎样才能改变plugin_dir_url到另一个文件夹?
我怎样才能改变这种两行代码它说:“plugin_dir_url”,所以从我的模板文件夹抓住文件?
class SYMPLE_TinyMCE_Buttons {
function __construct() {
add_action('init', array(&$this,'init'));
}
function init() {
if (! current_user_can('edit_posts') && ! current_user_can('edit_pages'))
return;
if (get_user_option('rich_editing') == 'true') {
add_filter('mce_external_plugins', array(&$this, 'add_plugin'));
add_filter('mce_buttons', array(&$this,'register_button'));
**wp_localize_script('jquery', 'sympleShortcodesVars', array('template_url' => plugin_dir_url(__FILE__)));**
}
}
function add_plugin($plugin_array) {
**$plugin_array['symple_shortcodes'] = plugin_dir_url(__FILE__) .'js/symple_shortcodes_tinymce.js';**
return $plugin_array;
}
function register_button($buttons) {
array_push($buttons, "symple_shortcodes_button");
return $buttons;
}
非常感谢。
请问你能写一个例子吗?我应该删除(__FILE__)?谢谢 –
你是对的!有用。谢谢! –