Home Forums General Issues Color field for wysiwyg dynamic link and heading colors.


Color field for wysiwyg dynamic link and heading colors.

  • Hi I have been trying to get the acf color field to show up as the link color and h1, h2 etc. in the wysiwyg editor. I know the custom post would need to be published first though I still haven’t been able to get it to work.
    I have tried adding a function to use a stylesheet however because it is php it isn’t recognising it.
    There is a way to lock the css however that doesn’t work for the wysiwyg editor.

    Another way might be to use jquery for the acf editor from here but not sure how to get it to work:

    Does anybody have success with enabling this for clients? It would make it easier for them to see the color as they enter the content. Yes each post will have a different color depending upon what they have chosen.


  • So looking at the javascript api I have this that works (not what I want):

    add_action('acf/input/admin_footer', function(){
            acf.addFilter('wysiwyg_tinymce_settings', function( mceInit, id, field ){
    			//if( field.get('data-toolbar') !== 'event_basic' ) {
                if(field.get('key') !== 'field_63f8196bb4c98'){
                    return mceInit;
                mceInit.block_formats = 'Paragraph=p;Heading 4=h4';
                return mceInit;

    The item blocked out is one part I want to work, it works on all wysiwyg not the type of that is needed:

    //if( field.get('data-toolbar') !== 'event_basic' ) {
  • Also this isn’t what I am trying to do – I need to target the wysiwyg as well as the color picker field and then assign the color picker field to the wysiwyg block formats paragraph, heading 1 etc. and the link color.

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

You must be logged in to reply to this topic.