Showing only certain buttons on tinymice content editor

I was wondering how to display just the following buttons:

bold

italic

underline

unordered list

ordered list

insert link

unlik

blockquote


Thanks in advance.

2 Answers
2

Hi @José Pablo Orozco Marín:

If you are looking for how to code the custom buttons yourself, WordPress’ Codex has a great example that shows you how:

  • http://codex.wordpress.org/TinyMCE_Custom_Buttons

The example is complicated because it shows you how to add your own controls but if you are using the standard buttons you don’t need to make is to complex. Here’s a list of the standard buttons:

  • http://tinymce.moxiecode.com/wiki.php/Buttons/controls

To illustrate I’ve modified the example to show only the buttons you wanted. This code can be placed in your theme’s functions.php file or in a .php file for a plugin that you might be writing:

function myplugin_addbuttons() {
  // Don't bother doing this stuff if the current user lacks permissions
  if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages') )
    return;

  // Add only in Rich Editor mode
  if ( get_user_option('rich_editing') == 'true') {
    add_filter('mce_buttons', 'register_myplugin_button');
  }
}

function register_myplugin_button($buttons) {
  $buttons = array(
    'bold',
    'italic',
    'underline',
    'bullist',
    'numlist',
    'link',
    'unlink',
    'blockquote',
  );
  return $buttons;
}

// init process for button control
add_action('init', 'myplugin_addbuttons');

And here’s what it looks like when add a New Post:

Leave a Comment