Home › Forums › General Issues › Conditional Fields – Color or Image – Add Via Dynamic Style Sheet › Reply To: Conditional Fields – Color or Image – Add Via Dynamic Style Sheet
Hi John,
1) Create a radio field. Give it a few values. For this example, set the field name to ‘my_radio’
2) Save the fieldset (shouldn’t be needed but just in case)
3) Create an image field
4) At the bottom, set Conditional Logic to “Yes”
5) In the dropdowns, select “my_radio” then “is equal to” and the last box should show a list of the options you entered into the radio field.
Getting the field info up to the body element is going to be tricky because of how/where you position the loop. Instead of using inline styles you could create a javascript block that adds that $style line to the body element. Something like jQuery('body').css('background-color', <?php echo $color; ?>);
where the css line would change depending on the conditional check in my first reply.
No idea how to do the dynamic style sheet thing. 🙂
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.