Home › Forums › Backend Issues (wp-admin) › Suggestions for creating dynamic stylesheets with ACF values › Reply To: Suggestions for creating dynamic stylesheets with ACF values
Hi – here is the way I do it.
1. Create an option page – something like “Theme Settings”
2. Add Fields for each css style I need
3. Group them in tabs for for mobile/tablet/desktop/HD
4. Define a hook which is fired once the option page is updated
5. The hook is generating a css file / it updates the css file
6. include the css file in your theme in function.php
If you want to go more advanced. Create a vars.less (I am using less and uikit) and compile the css with a less compiler, after the option page is saved. Like this I only load one css file
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
ACF PRO’s Flexible Content field allows you to create smaller pieces of UI and compose them into whole flexible patterns. In our latest article, we show how to use it to create swappable site sections and integrate it all in a theme.https://t.co/ZRocH8oJSp— Advanced Custom Fields (@wp_acf) January 24, 2023
© 2023 Advanced Custom Fields.