this adds a button, so you just need to configure it to create a popup
// register button function register_button($buttons) { array_push($buttons, "btn"); return $buttons; } // add button function add_button() { if ( current_user_can('edit_posts') && current_user_can('edit_pages') ) { add_filter('mce_external_plugins', 'add_plugin'); add_filter('mce_buttons', 'register_button'); } } // add plugin function add_plugin($plugin_array) { $plugin_array['btn'] =get_bloginfo('template_url').'/js/customcodes.js'; return $plugin_array; }
you will need to add the js file
(function() { tinymce.create('tinymce.plugins.btn', { init : function(ed, url) { ed.addButton('btn', { title : 'Add a btn', image : url+'/btn.png', onclick : function() { ed.selection.setContent('[btn]'); } }); }, createControl : function(n, cm) { return null; }, }); tinymce.PluginManager.add('btn', tinymce.plugins.btn); })();
source share