Okay
  Public Ticket #2185229
Dynamically change CSS background-color
Closed

Comments

  • [email protected] started the conversation

    Hi,

    Thank you for this great plugin.

    I would like to retrieve the value of ACF color picker to dynamically change the background color of a block. But it doesn't work... Could you please help me?

    In my HTML widget, I have:

    <div id="block1">

    <h1>{{current_post.title|raw}}</h1>

    </div>

    And in my CSS widget, I have:

    #block1 {

    background-color:{{current_post.cf_background-color-portfolio}};

    }

    But it doesn't work, I don't understand...

    Many thanks!

    Vincent

  •   Max replied privately
  • [email protected] replied

    Hi Max,

    I finally found the problem. And you were right. At the beginning, I had named the field "color-portfolio" and I was having an issue between "-" and "_". I just named the field "Color" and it's working. :)

    Thanks!!

    Vincent

  •   Max replied privately
  • [email protected] replied

    Hi Max,

    I'll try with another field. But I was having an issue with ACF and the image field. So I erased all spaces. 

    I wish I could give you an access to my WP website but I'm developing locally with Local by Flywheel so I cannot grant you an access unfortunately. 

    Btw, do you guys have plans to provide a masonry grid post in the future?

    Thanks,


    Vincent


  •   Max replied privately