Top

How to Unlock More Useful Buttons in the WordPress Post Editor

February 21, 2011

The WordPress post editor has nearly every button you might need for quickly customizing your content, but there are times when you may require a few more detailed style options than what it offers. Did you know that there are many more useful buttons that can be easily added to the visual editor? Check out this third row of buttons I’ve added to one of my blogs:

The other day I saw a handy tip over at catswhocode.com and thought I might expand on it show a little more of what’s possible. You’ll see above that I’ve added buttons which are not shown by default on the WordPress post editor, including horizontal rules, subscripts, superscripts, font select, font size select, clean up messy code, styles (alignment, captions, gallery, etc.)

Adding more buttons to the editor is really easy. Simply paste this snippet into your theme’s functions.php file.

function enable_more_buttons($buttons) {
  $buttons[] = 'hr';
  $buttons[] = 'sub';
  $buttons[] = 'sup';
  $buttons[] = 'fontselect';
  $buttons[] = 'fontsizeselect';
  $buttons[] = 'cleanup';
  $buttons[] = 'styleselect';
  return $buttons;
}
add_filter("mce_buttons_3", "enable_more_buttons");

The filter at the bottom is where you can change the row where the buttons are added: ie. mce_buttons_2 would be row 2. Save the changes to your file and you should be able to see your new buttons on the post and page editor screens.

The TinyMCE website has a full list of available buttons and plugins for adding to the editor. Mix and match to get whatever combination suits your particular needs.

The WordPress codex provides further information for adding custom TinyMCE buttons. You’ll find examples that show you how to include the buttons only if the user has the correct permissions. If you want something a little more advanced, the documentation also gives you a starting point for loading your own TinyMCE plugins for the WordPress editor.

I hope you find this tutorial useful. Enjoy customizing your post editor!

Tweet This Post

Comments

Got something to say?

Bottom
Article Archive  |  This site is a historical archive of pressography.com, a WordPress plugin and theme blog that published between 2006 and 2012. It is preserved for reference and is not operated by, affiliated with, or endorsed by its original authors. Nothing here is for sale and no form on this site is active. If you are the original owner and would like this domain returned, please get in touch.