Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_action( 'init', array( $this, 'btn_mapping' ) );
- add_action('admin_enqueue_scripts', array( $this, 'btn_scripts' ) );
- ---------------------------------
- public function btn_mapping(){
- //Abort early if the user will never see TinyMCE
- if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages') && get_user_option('rich_editing') == 'true')
- return;
- //Add a callback to regiser our tinymce plugin
- add_filter("mce_external_plugins", array( $this, "btn_register" ) );
- // Add a callback to add our button to the TinyMCE toolbar
- add_filter('mce_buttons', array( $this, 'btn_add' ) );
- }
- public function btn_register($plugin_array){
- $plugin_array['exeter_btn'] = EXETER_COMPANION_URI . '/assets/js/editor-button.js';
- return $plugin_array;
- }
- public function btn_add($buttons){
- $buttons[] = "exeter_btn";
- return $buttons;
- }
- public function btn_scripts(){
- wp_enqueue_style('exeter-tc', EXETER_COMPANION_URI . '/assets/css/editor.css');
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement