I have created a ‘Page Builder’ plugin that has 4 sets of field groups.
Columns – ( 100%, 50%/50%, 25%/75% ect )
Custom – ( Used if I want specific created modules per project )
Modules – ( Accordian, Contact Form, WYSIWIG Editior )
Settings – ( Row Settings, ie padding/background colour/text colour )
All the above work fine and flawlessly, basically the Columns are preset in the field groups and for example;
If i was to select 50%/50% – This would then generate the field group ‘Modules’. If I then add a WYSWIG editor in both, add an image in the left, and text in the right.. This works fine..
But my question is does ACF support where in my example I want to put an image in the left column but then add an additional option to re add columsn inside the right half to say another 50%/50%. So my column structure I would be after would be:
50% / [50% / 50% ]
I have tried cloning the columns field group inside the ‘Modules’ field group but it doesent render anything in the editor.
I hope someone can help!
No mine uses a custom CSS grid system – but you change the column width classes in the settings
$columns[‘six’] = ‘six columns’;
If you wanted to use bootstrap you would just change it to:
$columns[‘six’] = ‘col-lg-6’;
The reason that nothing shows when you try to clone the columns is that you’re creating an infinite loop cloning the fields
columns -> clone columns -> clone columns -> clone columns -> etc...
your sub columns will need to be different fields. Create a “sub columns” field group and then clone that into you columns.
Thank you for your reply John,
YES, this solved my issues. But because I am now doing flexible content within flexible content (both using cloned fields)
The data is not being pulled? It is storing in the database correctly but nothing is being pulled..
while ( have_rows( $id ) ) : the_row(); if( get_row_layout() == 'content' ): flexi_get_template_part( 'content' ); elseif( get_row_layout() == 'accordian' ): flexi_get_template_part( 'accordian' ); elseif( get_row_layout() == 'contact_form' ): flexi_get_template_part( 'contact-form' ); elseif( get_row_layout() == 'columns' ): //THIS IS WHERE I AM TRYING TO LOOP THROUGH MY CLONED SUB COLUMNS. $arr = get_defined_vars(); print_r($arr); endif; endwhile;
If you see in the columns, all it returns is $id string. It seems that nested flexible content is not supported?
Ignore my previous post – I managed to fix it!
You must be logged in to reply to this topic.
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!
© 2021 Advanced Custom Fields. Subscribe