Support

Account

Home Forums General Issues Add custom drop-down menu with custom styles to wysiwyg editor Reply To: Add custom drop-down menu with custom styles to wysiwyg editor

  • I’ve tried the code below. But this just returns the Full toolbar without the desired extra dropdown menu.

    add_filter( 'acf/fields/wysiwyg/toolbars' , 'my_toolbars'  );
    
    function my_toolbars( $toolbars ) {
    	$style_formats = array(  
    		array(
    			'title' => 'My style',
    			'block' => 'span',
    			'classes' => 'mystyle',
    			'wrapper' => true,
    		),
    	);
    
    	$toolbars['My toolbar'] = $toolbars['Full'];
    	$toolbars['My toolbar'][1]['styleselect'] = json_encode( $style_formats );
    
    	return $toolbars;
    }