[wp-hackers] Multiple additional TinyMCE plugins
Tom Barrett
tcbarrett at gmail.com
Wed Jun 20 11:15:39 UTC 2012
Hey ho
I'm adding some shortcodes with a graphical representation in the post
editor. Like the gallery shortcode or image tags.
I have something that works, and have added a single external plugin using
this codex page as a template:
http://codex.wordpress.org/TinyMCE_Custom_Buttons
I would like a .js file for each shortcode, and have tried simply adding
another item to the array:
<code>
add_action('init', 'myplugin_addbuttons');
function myplugin_addbuttons() {
if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages')
)
return;
// Add only in Rich Editor mode
if ( get_user_option('rich_editing') == 'true') {
add_filter( 'mce_external_plugins', 'add_myplugin_tinymce_plugin', 99 );
//add_filter( 'mce_buttons', 'register_myplugin_button' );
}
}
function add_myplugin_tinymce_plugin($plugin_array) {
// The first item here breaks.
$plugin_array['wppluginone'] = THEMEURL .
'/js/tinymce-shortcode-pluginone.js';
$plugin_array['wpplugintwo'] = THEMEURL .
'/js/tinymce-shortcode-plugintwo.js';
return $plugin_array;
}
</code>
However this breaks the 'edit' and 'del' buttons on whichever plugin is
listed first. If I swap the two lines then other one works. I've opened it
in firefox with firebug open and I get no js errors in the console.
Any ideas where to look for this behaviour?
--
http://www.tcbarrett.com | http://gplus.to/tcbarrett |
http://twitter.com/tcbarrett
More information about the wp-hackers
mailing list