Hi there!
Does this happen if you deactivate all your plugins or use a bundled theme like Twenty Fourteen/Fifteen?
@jose Castaneda
Yes. I disabled all plugins and tried with Twenty Fourteen. Here is code in functions.php
function wpi_post_editor_buttonhooks() {
// Only add hooks when the current user has permissions AND is in Rich Text editor mode
if ( ( current_user_can('edit_posts') || current_user_can('edit_pages') ) && get_user_option('rich_editing') ) {
add_filter("mce_external_plugins", "wpi_post_editor_register_tinymce_javascript");
add_filter('mce_buttons', 'wpi_post_editor_register_buttons');
}
}
function wpi_post_editor_register_buttons($buttons) {
array_push($buttons, '|', 'slider');
return $buttons;
}
// Load the TinyMCE plugin : editor_plugin.js (wp2.5)
function wpi_post_editor_register_tinymce_javascript($plugin_array) {
$plugin_array['wpi_post_editor'] = get_template_directory_uri() . '/js/editor.js';
return $plugin_array;
}
// init process for button control
add_action('init', 'wpi_post_editor_buttonhooks');
And here is the code of editor.js:
jQuery(function($) {
(function() {
// prepare box for input content
tinymce.create('tinymce.plugins.Wpi_post_editor', {
init : function(ed, url) {
// Contact
ed.addButton('slider', {
title : 'Slider',
cmd : 'slider',
image : 'slider.png'
});
},
});
// Register plugin
tinymce.PluginManager.add( 'wpi_post_editor', tinymce.plugins.Wpi_post_editor );
})();
});
I also found, we can not add shortcode with name “button”. That’s disappointed.