Hi I would like to have flexible filed within flexible field (yea flexible field inception)
Here’s what I’m looking for.
I have 2 layouts in 1 flexible field
I would like to make “Field Layout 2” field Flexible.
So following can be my sub fields.
Following is complete example of what I’m looking for
I’m aware currently I cant add flexible field as sub field of flexible field.
But is there any other way I can achieve this?
This is not currently possible but I will think about adding in the flexible content field to the list of sub fields in the next verison.
For now, you will need to edit the add-on field file and find the line of code where the flexible content field is removed (unset) from the field type choices. Just comment out that line, and you will be able to achieve this,
Thanks Elliot! Works like charm! 🙂
BTW. I managed to create flexible field inside flexible in dashboard. Now when I’m trying to return value of this fields in front end.But its not returning value of sub flexible fields.
I’m using following is code.
<?php while (has_sub_field("main_field")): ?>; <?php if (get_row_layout() == "layout_1"): ?> <div> <php the_sub_field("textarea"); ?> </div> <?php endif; ?> <?php if (get_row_layout() == "layout_2"): ?> <?php if (get_sub_field("main_2")): ?> <?php if (get_row_layout() == "layout_2a"): ?> <div> <?php the_sub_field("text_field"); ?> </div> <?php elseif (get_row_layout() == "layout_2b"): ?> <img src="<?php the_sub_field('image_field'); ?>" class="alignnone size-full" /> <?php endif; endif; endif; ?> <?php endwhile; ?>
Hi @elliot, could you update this with the current status please? (Re. nested Flexible Content Fields.) Is nesting available in v5? I’m happy to pay for the upgrade, but I want to make sure I can achieve what I need first.
I’d like to add a row called “row of teasers” and then, instead of always having the same sub-elements (“Add teaser”), be able to choose for each teaser (sub element) what kind of teaser it is.
One teaser would contain two simple fields, title and text. Another would contain an image and a caption. Another would contain a title and a list of related posts, filtered by a selected taxonomy.
(A visual example of my goal is at http://spruce.it/noise/highly-flexible-layouts-using-acf-flexible-content-fields-repeater-fields/: their first two yellow screenshots are what I’m aiming for. However, these three elements side-by-side are just one row of several in the page.)
The topic ‘Flexible Field within Flexible Field ?’ is closed to new replies.
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!
© 2023 Advanced Custom Fields.