Advertisement
Guest User

Untitled

a guest
Apr 21st, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1.  
  2. add_action( 'init', array( $this, 'btn_mapping' ) );
  3. add_action('admin_enqueue_scripts', array( $this, 'btn_scripts' ) );
  4.  
  5. ---------------------------------
  6.  
  7. public function btn_mapping(){
  8.  
  9. //Abort early if the user will never see TinyMCE
  10. if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages') && get_user_option('rich_editing') == 'true')
  11. return;
  12.  
  13. //Add a callback to regiser our tinymce plugin
  14. add_filter("mce_external_plugins", array( $this, "btn_register" ) );
  15.  
  16. // Add a callback to add our button to the TinyMCE toolbar
  17. add_filter('mce_buttons', array( $this, 'btn_add' ) );
  18.  
  19. }
  20.  
  21. public function btn_register($plugin_array){
  22. $plugin_array['exeter_btn'] = EXETER_COMPANION_URI . '/assets/js/editor-button.js';
  23. return $plugin_array;
  24. }
  25.  
  26. public function btn_add($buttons){
  27. $buttons[] = "exeter_btn";
  28. return $buttons;
  29. }
  30.  
  31. public function btn_scripts(){
  32. wp_enqueue_style('exeter-tc', EXETER_COMPANION_URI . '/assets/css/editor.css');
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement