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
I tried couple of things, found this plugin https://github.com/mvpdesign/acf-reusable-field-group which in a way would be possible to make it but it doesn’t seem to work (attached the fields structure).
and here is the code i’m running through the template:
<?php
// check if the repeater field has rows of data
if( have_rows('modules_all') ):
// loop through the rows of data
while ( have_rows('modules_all') ) : the_row(); ?>
<?php
$checkboxcustom = get_sub_field('is_custom_modules');
if($checkboxcustom) { // is yes ?>
CUSTOM
<?php
if( have_rows('modules_custom') ):
while ( have_rows('modules_custom') ) : the_row(); ?>
<?php if( get_row_layout() == 'module_sample' ): ?>
<?php get_template_part('templates/modules-custom/module', 'sample') ?>
<?php endif; ?>
<?php endwhile; ?>
<?php endif; ?>
<?php } else { ?>
MAIN
<?php
if( have_rows('modules_main') ):
while ( have_rows('modules_main') ) : the_row(); ?>
<?php if( get_row_layout() == 'module_main' ): ?>
<?php get_template_part('templates/modules-main/module', 'main') ?>
<?php endif; ?>
<?php endwhile; ?>
<?php endif; ?>
<?php } ?>
<?php endwhile;
else :
endif;
?>
IT seems to be working nicely for the Main fields but not the Custom one, as they are not beeing displayed.
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.