Support

Account

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>
    }