Support

Account

Home Forums Backend Issues (wp-admin) Apply Filters to WYSIWYG

Solving

Apply Filters to WYSIWYG

  • I’m trying to edit the ACF WYSIWYG editor in the way that you edit the WordPress one with filters.

    http://codex.wordpress.org/TinyMCE#Customize_TinyMCE_with_Filters

    Is there any way to apply these settings or similar ones to the ACF editor?

    function my_format_TinyMCE( $in ) {
    	$in['remove_linebreaks'] = false;
    	$in['gecko_spellcheck'] = false;
    	$in['keep_styles'] = true;
    	$in['accessibility_focus'] = true;
    	$in['tabfocus_elements'] = 'major-publishing-actions';
    	$in['media_strict'] = false;
    	$in['paste_remove_styles'] = false;
    	$in['paste_remove_spans'] = false;
    	$in['paste_strip_class_attributes'] = 'none';
    	$in['paste_text_use_dialog'] = true;
    	$in['wpeditimage_disable_captions'] = true;
    	$in['plugins'] = 'tabfocus,paste,media,fullscreen,wordpress,wpeditimage,wpgallery,wplink,wpdialogs,wpfullscreen';
    	$in['content_css'] = get_template_directory_uri() . "/editor-style.css";
    	$in['wpautop'] = true;
    	$in['apply_source_formatting'] = false;
            $in['block_formats'] = "Paragraph=p; Heading 3=h3; Heading 4=h4";
    	$in['toolbar1'] = 'bold,italic,strikethrough,bullist,numlist,blockquote,hr,alignleft,aligncenter,alignright,link,unlink,wp_more,spellchecker,wp_fullscreen,wp_adv ';
    	$in['toolbar2'] = 'formatselect,underline,alignjustify,forecolor,pastetext,removeformat,charmap,outdent,indent,undo,redo,wp_help ';
    	$in['toolbar3'] = '';
    	$in['toolbar4'] = '';
    	return $in;
    }
    add_filter( 'tiny_mce_before_init', 'my_format_TinyMCE' ); 

    Thanks!

  • You can modify the toolbars with the acf/fields/wysiwyg/toolbars filter like this

    function my_toolbars( $toolbars ) {
    	$toolbars['Full'] = array();
    	$toolbars['Full'][1] = array('bold', 'italic', 'underline', 'bullist', 'numlist', 'alignleft', 'aligncenter', 'alignright', 'alignjustify', 'link', 'unlink', 'hr', 'spellchecker', 'wp_more', 'wp_adv' );
    	$toolbars['Full'][2] = array('styleselect', 'formatselect', 'fontselect', 'fontsizeselect', 'forecolor', 'pastetext', 'removeformat', 'charmap', 'outdent', 'indent', 'undo', 'redo', 'wp_help' );
    
    	// remove the 'Basic' toolbar completely (if you want)
    	unset( $toolbars['Basic' ] );
    
    	// return $toolbars - IMPORTANT!
    	return $toolbars;
    }
    add_filter('acf/fields/wysiwyg/toolbars' , 'my_toolbars');

    Hope this helps

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

The topic ‘Apply Filters to WYSIWYG’ is closed to new replies.