Page 1 of 1
Forum

Welcome to the Tweaking4All community forums!
When participating, please keep the Forum Rules in mind!

Topics for particular software or systems: Start your topic link with the name of the application or system.
For example “MacOS X – Your question“, or “MS Word – Your Tip or Trick“.

Please note that switching to another language when reading a post will not bring you to the same post, in Dutch, as there is no translation for that post!



WordPress - Add but...
 
Share:
Notifications
Clear all

[Solved] WordPress - Add buttons to TinyMCE in the admin pages

1 Posts
1 Users
0 Reactions
1,554 Views
 Hans
(@hans)
Famed Member Admin
Joined: 12 years ago
Posts: 2859
Topic starter  

WordPress uses TinyMCE as their "rich" editor, and you can add some standard buttons to it with ease. I needed a few of these standard buttons, so here we go:

The basic function is:

function set_tinymce_buttons_row($buttons)
{
    array_push($buttons, "sup", "sub", "anchor", "hr");
    return $buttons;
}
add_filter('mce_buttons', 'set_tinymce_buttons_row');

You will have to add this to the functions.php file.

The example above adds superscript, subscript, anchor, and horizontal line to the first button row.

Adding these buttons instead to the second button row can be done as such (note the mce_buttons_2 in the last line which indicates the 2nd row, you can use mce_buttons_3 for the 3rd row, but I haven't seen the 3rd row in use for anything):

function set_tinymce_buttons_row2($buttons)
{
    array_push($buttons, "sup", "sub", "anchor", "hr");
    return $buttons;
}
add_filter('mce_buttons_2', 'set_tinymce_buttons_row2');

A list of standard available buttons can be found on the TinyMCE website.


   
ReplyQuote
Share: