Hi all,
I have flexible content field. What i want to achieve is to get all fields from EACH module1 inside module2.
How can i do this?
Here is the demo code:
<?php
if( have_rows('modules') ): while ( have_rows('modules') ) : the_row();
if( get_row_layout() == 'module1' ): echo the_sub_field('text1');
elseif( get_row_layout() == 'module2' ): echo the_sub_field('text2'); echo 'ALL FIELDS FROM MODULE1';
elseif( get_row_layout() == 'module3' ): echo the_sub_field('text3');
endif; endwhile; endif; ?>
Thanks!
Have you looked at Working with Nested Repeaters?
This is a tutorial that covers working with nested repeaters and flexible content fields.