Support

Account

Home Forums Add-ons Flexible Content Field Flexible Field within Flexible Field ?

Solved

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

    • Field Layout 1
    • Field Layout 2

    I would like to make “Field Layout 2” field Flexible.
    So following can be my sub fields.

    • Field Layout 2a
    • Filed Layout 2b

    Following is complete example of what I’m looking for

    • Main Field
      • Field Layout 1
      • Field Layout 2
        • Field Layout 2a
        • Filed Layout 2b

    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 @svenni ,

    /plugins/acf-flexible-content/flexible-content.php

    Is the file

  • 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

  • Can we get this added permanently?
    Thanks

  • 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

  • Terrific! Order coming shortly 🙂

  • 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

    code snippet

Viewing 14 posts - 1 through 14 (of 14 total)

The topic ‘Flexible Field within Flexible Field ?’ is closed to new replies.