I’m not getting this to work.
I have the following code for adding the emoticons plugin. The plugin file is located at /wp-content/themes/theme-child/js/tinymce/emoticons/plugin.min.js
:
add_filter('mce_external_plugins', 'my_custom_plugins');
function my_custom_plugins($plugins_array) {
$plugins = array('emoticons'); //Add any more plugins you want to load here
//Build the response - the key is the plugin name, value is the URL to the plugin JS
foreach ($plugins as $plugin ) {
$plugins_array[ $plugin ] = get_stylesheet_directory_uri() . '/js/tinymce/' . $plugin . '/plugin.min.js';
}
return $plugins_array;
}
And for the buttons customization I use:
function bbp_enable_visual_editor( $buttons = array() ) {
$buttons['tinymce'] = array(
'toolbar1' => 'bold, italic, underline, strikethrough, blockquote, alignleft, aligncenter, alignright, alignjustify, justifyfull, bullist, numlist, outdent, indent, undo, redo, link, unlink, table, fullscreen',
'toolbar2' => 'formatselect, fontselect, fontsizeselect, styleselect, strikethrough, outdent, indent, pastetext, removeformat, charmap, wp_more, emoticons, forecolor, wp_help,media,image', // 2nd row, if needed
'plugins' => 'paste,emoticons'
);
$buttons['quicktags'] = array ('buttons' => 'strong,em,link,block,del,ins,img,ul,ol,li,code,close');
return $buttons;
}
add_filter('bbp_after_get_the_content_parse_args', 'bbp_enable_visual_editor');
add_filter('mce_buttons', 'bbp_enable_visual_editor');
It doesn’t load the visual editor, unless I remove emoticons from the plugins. I don’t see the my_custom_plugins()
function doing anything. What am I doing wrong?