Home › Forums › General Issues › How to mark a field as a toggle-field for conditional logic
I’m using a plugin by Daniel Pataki which creates a field where the user can choose a role for their WP user. However I guess this question applies to the creation of any custom field:
How can I get ACF to recognise a custom field as a toggle-field so that I can use conditional logic.
Example: http://f.markb.me/1auU3
Is it as simple as adding a parameter to the field creation/render function that will enable it as a conditional-logic based field?
If I understand correctly there are already checkbox fields and radio button field types that you can change your custom field too…See the ‘Field Type’ dropdown.
thanks @magicstick. the problem is the field in that plugin, is not being recognised as a field that can be used with conditional logic. The plugin allows for select/radio/checkbox methods, but neither of these are being identified as conditional-logic friendly fields.
i have asked the plugin author on Github about this, but was wondering if there’s some way i can perhaps do it myself if i know how ACF identifies a field as being usable in a conditional-logic rule
If you can be more specific as to what method you are trying to use then I can provide an example because they can absolutely be used for logic. Pretty much the whole reason for them 🙂
The field is from another plugin that creates checkboxes, so unless the author of that add on plugin also made modification to the conditional logic code, then no, it can’t be used for conditional fields.
If you want to do this you’ll need to not use the add on and use a standard ACF checkbox field and dynamically generate the values for the field. The example given here can also be used for checkboxes http://www.advancedcustomfields.com/resources/dynamically-populate-a-select-fields-choices/
Thanks @hube2 @magicstick
I think the problem lies with the plugin then. Will wait to see what the developer says.
Appreciate the help anyways.
The topic ‘How to mark a field as a toggle-field for conditional logic’ is closed to new replies.
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.