Home › Forums › Add-ons › Flexible Content Field › Flexible Field within Flexible Field ?
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?
Thanks
Hi @kuldeep
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
Thanks Elliot! Works like charm! 🙂
EDIT
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 @kuldeep
I can’t see the line of code where you target the sub flexible field. Perhaps you could explain the issue with more detail?
Hi @elliot,
Really sorry about this. My bad, I updated the code and now its working fine.
I fixed it when I was trying to explain my problem here.
So yes everything works like charm. 🙂
Thanks a lot,
Kuldeep
Hi,
can someone of you tell me, which file
the add-on field file
it is exactly that I must edit?
Greetings,
Svenni
Hi kuldeep,
/plugins/acf-flexible-content/flexible-content.php
Is the file
thank you. Now I found it. Now it work’s like a charm. 🙂
Greetings,
Svenni
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.
Many thanks!
(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.)
Hi @mhm-li
Sorry for the delay.
Yes, ACF5 allows infinite inception for both repeater and flexible content fields.
Cheers
E
For those still having this problem the place to change this is at “acf-flexible-content/4/views/options.php” line 16 as seen in the image
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!
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.