Dynamic content, how to reference color in preference

Hello ! since the last update, it’s now possible to use dynamic content in CSS editor.
I would like to know if it’s possible to reference color set in preference with dynamic content so i can use it in my css ?
Thanks !

Hello @popoche,

Thanks for writing in!

If you are using custom fields or ACF Pro plugin in setting up a color preference, you may be able to access the color preference and use it in your CSS something like this:

Using custom fields:

.my-element-class {
  color: {{dc:post:meta key="color"}};
}

Using ACF Pro plugin:

.my-element-class {
  color: {{dc:acf:post_field_setting field="color"}};
}
.my-element-class {
  color: {{dc:acf:post_field field="color"}};
}

Be advised that the code above is just an example and will not work out of the box. You will need to have in-depth knowledge of the CSS and the dynamic content so that you can accomplish what you want to do.

Please note that the code provided above serves as a guide only and is to help you in getting started so implementing it and maintaining the code will be out of our support scope and for further maintenance for new possible versions of the theme that may cause the customization to break, you will need to hire a developer.

Best Regards.

Thanks a lot for your reply, i know how to do it with ACF but i was referring to the colors set inside themeco preference menu. I was wondering if there was a way to access them with dynamic content, it would be very useful since we can use DC in css now. Thanks !

Hello @popoche,

Regretfully there is no option for that at the moment. It would be custom development. I would suggest you contact a developer who can assist you with your concern or you can avail our services called One where customization question is answered.

Please note we don’t provide custom development support It is out of the support scope.

Thanks for understanding

Okay thanks for the informations.

You are most welcome.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.