• Resolved Anne-Mieke Bovelett

    (@annebovelett)


    Hi Shea,

    I’ve created a bunch of colorpicker fields with ACF Pro (5.9.1). In Elementor Pro (V.3.0.11) they parse just fine, straight in a page.

    I wanted to add some custom CSS through a snippet, but the sample code has no effect. The CSS appears, but the value from the field does not. What am I missing?

    add_action( 'wp_head', function () { ?>
    <style>
    
    	.bktest {
    		background-color: <?php the_field('farbe_handbikes'); ?>;
    	}
    
    </style>
    <?php } );
    

    Cheers from Germany,

    Anne

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Anne-Mieke Bovelett

    (@annebovelett)

    “It’s not you, it’s me”… ??

    I just figured out that it’s not an issue related to the Code Snippets plugin. For educational purposes for whoever stumbles upon this post:

    I had not set the fields to be global (by setting them as Options). See this article from ACF about the options page.

    Cheers,

    Anne

    Plugin Author Shea Bunge

    (@bungeshea)

    Hi Anne,

    Good to hear you managed to figure out what was going wrong! I had thought that potentially you needed to refer to a post in the_field when calling it like this.

    Thread Starter Anne-Mieke Bovelett

    (@annebovelett)

    Yeah ??

    But… in case you get Elementor users here, saying it also doesn’t work when the ACF field group is added to the options page, and they did everything right by writing:

    background-color: <?php the_field('name_of_your_colorpicker_field', 'option'); ?>;

    I just found out that it’s an acknowledged bug that values from colorpicker fields, when set in options, aren’t being displayed.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘ACF Colorpicker field not parsed in CSS snippet’ is closed to new replies.