Home › Forums › General Issues › get_field / get_sub_field conditional? › Reply To: get_field / get_sub_field conditional?
@nyrngrs24 I have done this with cloned fields, what I do is that I encapsulate the cloned field in group fields. Basically I create a group field and then I add one sub field which is the clone. This means that the fields are always sub fields.
However, my purpose for doing this was so that I could add the same clone multiple times and the group field is named differently each time so it does require different have_rows() loops.
I get around this by getting the entire group in my template and then calling a function with the array value returned.
$args = get_field('group-field-name');
my_function($args);
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.