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!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.