Site icon StartFunction

How to display hidden buttons in TinyMCE for WordPress

Ever wished you could mark a number as a subscript or simply add an hr ruler in WordPress TinyMCE? With this trick you will learn how to display additional hidden buttons for this rich text editor.

Add the following code to your theme’s functions.php file:

[php]

function ilc_mce_buttons($buttons){
array_push($buttons, "backcolor");
return $buttons;
}
add_filter("mce_buttons", "ilc_mce_buttons");

[/php]

Log in into WordPress and go to your post writing section and you will see the new buttons available. Here’s a list of the useful buttons that you can display:

  • anchor
  • backcolor
  • cleanup
  • code
  • copy
  • cut
  • fontselect
  • fontsizeselect
  • hr
  • paste
  • redo
  • styleselect
  • sub
  • sup
  • undo

To add them just replace the “backcolor” string in the code above or add them like this:

[php]
function ilc_mce_buttons($buttons){
array_push($buttons, "backcolor", "anchor", "hr", "fontselect", "sub", "sup");
return $buttons;
}
add_filter("mce_buttons", "ilc_mce_buttons");

[/php]

That would add the background color select, an anchor builder, a button to add an hr ruler, a drop down to select the font family, and two buttons to mark text or numbers as subscripts or superscripts.

Exit mobile version