Support

Account

Home Forums General Issues Add options to wysiwyg toolbar Reply To: Add options to wysiwyg toolbar

  • 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;
      }
    }