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!
I used the plugin you mentioned and the logic seems fine on the backend etc.
A Repeater field (so i can mix and match the flexible content)
A.1 Checkbox to choose to have flexible content A or B
A.2 Reusable field of Flexible content A (core modules for use on other websites)
A.3 Reusable field of Flexible content B (specific custom modules used for specific website).
The frontent/template part is a bit tricky.
Repeater field
– checkbox
— Reusable Field group (ex. modules_main_reusable)
— Flexible content field (ex. modules_main)
—- Field types for the flexible layout
How should i call the modules_main_reusable field type? like this:
if( have_rows('modules_main_reusable') ):
while ( have_rows('modules_main_reusable') ) : the_row();
And then add the flexible repeater code inside it?
<?php
if( have_rows('modules_main') ):
while ( have_rows('modules_main') ) : the_row(); ?>
<?php if( get_row_layout() == 'module_sample' ): ?>
<?php get_template_part('templates/modules-main/module', 'sample') ?>
<?php endif; ?>
<?php endwhile; endif; ?>
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.