Support

Account

Home Forums Backend Issues (wp-admin) Add Editor style to specific WYSIWYG field

Solving

Add Editor style to specific WYSIWYG field

  • I have a page with 2 WYSIWYG fields, one of them will be used for Arabic language, so I need to add a “direction: rtl” in the WYSIWYG field’s styling.

    I would use WordPress’s way to add a style to the editor, but in my case I want the style to appear only for my 2nd WYSIWYG field (the arabic one):

    Wordpress’s way:
    function my_theme_add_editor_styles() {
    add_editor_style( ‘style-editor.css’ );
    }
    add_action( ‘init’, ‘my_theme_add_editor_styles’ );

  • Hi @patricksaad

    Can this be achieved with CSS or does it require JS?

    Thanks
    E

  • Hello

    It’s an Iframe so CSS is out of the question … might be doable with JS though, but I thought there would be a PHP way to do it since there’s already a WordPress hook for the Editor style (add_editor_style). I ended up using a plugin to add Direction buttons on the Editor Toolbar, but I’m still curious whether there’s away to do it without using another plugin.

  • Hi @patricksaad

    I have a feeling that the add_editor_style hook will set some default values in the tinyMCE JS object.

    It is possible that ACF would also use theye by default (I haven’t tested this myself) but I wonder If I can add some filter to allow for this as well!

    Thanks
    E

  • It’d be nice to add these to ACF wysiwyg fields exclusively, different from the other wysiwyg fields default in wordpress.

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

The topic ‘Add Editor style to specific WYSIWYG field’ is closed to new replies.