Support

Account

Home Forums ACF PRO Is it possible to have 2 flexible field groups, but they work like one Reply To: Is it possible to have 2 flexible field groups, but they work like one

  • @floflo91 thanks for the help! That one works well for the normal fields inside the Reusable field but not for a flexible field inside a Reusable field.

    i tried to use print_r
    <?php print_r(get_sub_field('modules_custom_reusable')); ?>
    which outputted:

    Array ( [modules_custom] => Array ( [0] => Array ( [acf_fc_layout] => module_sample [content_title] => text field inside flexible ) ) [content_title] => text field outside flexible )

    So it is picking up the content of the flexible field i just don’t know how to pull them out separately and apply the layout fields. :/ Will try it more.

    Here are the templates for the normal fields in case anyone will need them.

    Inside a repeater:

          <?php if( have_rows('repeater') ): ?>
    
              <?php while( have_rows('repeater') ): the_row(); ?>
    
                  <?php
                  if (get_sub_field('reusable_field')) {
                    foreach (get_sub_field('reusable_field') as $p) {
                      echo $p;
                      the_sub_field('subfieldName');
                      the_sub_field('subFieldName2');
                    }
                  } ?>
    
              <?php endwhile; ?>
    
          <?php endif; ?>

    inside a flexible field type:

    <?php
    
    if( have_rows('flexible') ):
    
        while ( have_rows('flexible') ) : the_row();
    
            if( get_row_layout() == 'layout_flexible' ): ?>
    
                  <?php
                  if (get_sub_field('reusable_field_group_')) {
                    foreach (get_sub_field('reusable_field_group') as $p) {
                      echo $p;
                      the_sub_field('subfieldName');
                      echo "<br>";
                      the_sub_field('subFieldName2');
                    }
                  } ?>
    
           <?php elseif( get_row_layout() == 'other' ):
    
            endif;
    
        endwhile;
    
    else :
    
    endif;
    
    ?>