Support

Account

Home Forums General Issues Add options to wysiwyg toolbar

Solving

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.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.