Web Development WordPress

Unlock more useful buttons in WP editor

WordPress on basic level has nearly covered every button that one needs for quick customization of the content. But besides what WP offers , there are situations that one may require a few/more detailed style options. Like font size, font family etc. These buttons can be brought up and used in the editor without any external plugins. The multi functional functions.php file comes into play here. 

While surfing, I found something really intresting in http://www.sycha.com/wordpress-add-hr-button-tinymce-visual-editor and thought i might give a try, and here is the result.

In order to revel the hidden buttons, simply add the following lines of code the your functions.php

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 button allows you to change the row where the buttons needs to be added. For eg, mce_buttons_3 allows you to add the buttons in the third row, similarly, mce_buttons_2 and mce_buttons will add the buttons in the second and first row respectively.
Also if you want to reorder the buttons the simply add numbers in $buttons[]. For eg,

 function enable_more_buttons($buttons) {
 $buttons[1] = 'fontselect';
 $buttons[2] = 'fontsizeselect';
 $buttons[3] = 'styleselect';
return $buttons;
 add_filter("mce_buttons_3", "enable_more_buttons");

If you need more, the TinyMCE website has got full list of available buttons and plugins over here (http://www.tinymce.com/wiki.php/Buttons/controls) for your editor. Also you can find further more information at WordPress codex for adding custom TinyMCE buttons (http://codex.wordpress.org/TinyMCE_Custom_Buttons).

Customize your editor as you per your need and enjoy :)