Home › Forums › General Issues › Add options to wysiwyg toolbar
Hi,
Wondering if it’s possible to add additional tools/icons to a wysiwyg toolbar.
For example, we can create a new toolbar OK by using the ‘acf/fields/wysiwyg/toolbars’ filter to add to the toolbars array, but can we also add tools/icons for say:
Subscript
Superscript
Something else that isn’t there by default
Thanks,
Nick
This looks to be more a question about editing TinyMCE, the editor that powers the WordPress WYSIWYG.
There are a number of plugins that can do what you need, here is one as a starting point:
https://wordpress.org/plugins/tinymce-advanced/
This is an OLD question, but I stumbled upon it when trying to answer how to add items to the pre-defined Basic menu. Here is the code I’ve used, which was written using the information found at ACF.
/********************************
ADD ADDITIONAL TOOLBAR SET TO ACF WYSIWYG
********************************/
if ( function_exists( 'get_field' ) ) {
add_filter( 'acf/fields/wysiwyg/toolbars' , 'qd_toolbars' );
function qd_toolbars( $toolbars )
{
//INJECT/ADD AN OPTION INTO THE BASIC TOOLBAR
$toolbars['Basic' ][1] = array_merge( array_slice( $toolbars['Basic' ][1], 0, 3, true ), array( 'subscript','superscript' ), array_slice( $toolbars['Basic' ][1], 3, null, true ) );
//FIND MORE INFO ABOUT THIS OPERATION AT http://www.advancedcustomfields.com/resources/customize-the-wysiwyg-toolbars/
// Add a new toolbar called "Very Simple"
// - this toolbar has only 1 row of buttons
$toolbars['Very Simple' ] = array();
$toolbars['Very Simple' ][1] = array('bold' , 'italic' , 'underline', 'link', 'unlink' );
// return $toolbars - IMPORTANT!
return $toolbars;
}
}
@ekazda Thanks for sharing this solution. I just used it today. I greatly appreciate you coming back to the forum to share a solution with the community.
The topic ‘Add options to wysiwyg toolbar’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.