Add ‘hr’ Button To TinyMCE Editor


As you know that the default WordPress post editor is based on the TinyMCE WYSIWYG editor, which can be used to edit post and page content. It comes with a variety of buttons, but it is also possible to add your own buttons to the editor toolbar.

Sometimes you might need to use horizontal line in your post to separate it into few segments. Adding the following code into the functions.php of your WordPress theme will add a <hr /> button to the TinyMCE editor.

[php]
function add_more_buttons($buttons) {
$buttons[] = ‘hr’;
return $buttons;
}
add_filter("mce_buttons", "add_more_buttons"); // botton add to first row

// add_filter("mce_buttons_2", "add_more_buttons"); // botton add to second row
// add_filter("mce_buttons_3", "add_more_buttons"); // botton add to third row
[/php]

 Reference:

You may also be interested in our other articles on get post content by id, remove feeds form wordpress, allow more tags in comments and generate QR codes for posts.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *