Home › Forums › Add-ons › Repeater Field › Use of repeater field with conditional logic › Reply To: Use of repeater field with conditional logic
Wow thank you! The explanation was very helpful and the example added a bit to my understanding of PHP and ACF. Very much appreciated.
By your example of both ‘switch’ and ‘if’ method it looks that I may have solved the issue of content being repeated and retained in each row. However, I’m not able to actually to continue any further with this method without being able to assign an ID or class to each of the 4 potential radio button selections.
The output is correct, but it needs a container and formatting.
Is there anyway to integrate a <div> container to wrap around each of the options, or at least assign an ID or Class to each one?
Example of what I have working now:
if ($content_type == 'image') {
the_sub_field('image_content');
}
elseif ($content_type == 'wysiwyg') {
the_sub_field('wysiwyg_content');
}
elseif ($content_type == 'quote') {
the_sub_field('text_content');
}
elseif ($content_type == 'video') {
the_sub_field('video_content');
}
And example of what I’m trying to accomplish (I know this is incorrect, but this is my brute example):
elseif ($content_type == 'video') {
<div class="full-width">the_sub_field('video_content');</div>
}
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.