Support

Account

Home Forums General Issues Wysiwyg, formatselect

Solved

Wysiwyg, formatselect

    • PerS

    • November 20, 2013 at 8:46 am

    When modifing the wysiwyg editor, is it possible to change the content of formatselect ?

    • Elliot

    • November 20, 2013 at 10:21 am

    Hi @pers

    Could you please elaborate a bit more on what ‘formatselect’ select is? I’m not familiar with this.

    Thanks
    E

    • PerS

    • November 20, 2013 at 9:58 pm

    formatselect is the pull down list in the editor with h1,h2,h3 ..

    • Elliot

    • November 22, 2013 at 9:48 am

    Hi @pers

    Thanks for clarifying.
    I know that this is possible using a filter on all WP WYSIWYG called ‘tiny_mce_before_init’, but this will be applied to all fields, not specific ACF fields…

    I found this article on stack exchange which may be a good starting point:
    http://wordpress.stackexchange.com/questions/3882/can-i-add-a-custom-format-to-the-format-option-in-the-text-panel

    Good luck

    Thanks
    E

    • PerS

    • November 23, 2013 at 11:50 pm

    Thank you, this is what I needed:

    
    add_filter('tiny_mce_before_init', 'wpse3882_tiny_mce_before_init');
    function wpse3882_tiny_mce_before_init($settings) {
        $settings['theme_advanced_blockformats'] = 'p,h1,h2';
        return $settings;
    }
    
  • This doesn’t seem to work for ACF WYSIWYG’s – is there another solution?

  • For anyone struggling with this, post WP 3.9 you’ll have to do this:

    add_filter( 'tiny_mce_before_init', function( $settings ){
    
    	$settings['block_formats'] = 'Paragraph=p;Heading=h2;Subheading=h3';
    
    	return $settings;
    
    } );
  • Hi there,

    The snippet that darrengrant posted works great:

    add_filter( ‘tiny_mce_before_init’, function( $settings ){
    $settings[‘block_formats’] = ‘Paragraph=p;Heading=h2;Subheading=h3’;
    return $settings;
    } );

    Though it applies to all wordpress wysiwyg’s. Is there a way to limit it to ACF wysiwyg fields only?

    Cheers,

  • I don’t think so it’s possible you should try another way to find out it

  • What I get in the TinyMCE editor is Formats dropdown without any custom format inside it.

    Does anyone has any idea how to solve it? I need to add a custom format to add a class to text, eg. image caption, body text etc.

    After going to Keystone.js files I found out that it is using TinyMCE ver 4.4.3 and Keystone ver is 4.0 RC.

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

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.