Support

Account

Home Forums Add-ons Flexible Content Field Cloned Flexible Content Field- How to loop?

Unread

Cloned Flexible Content Field- How to loop?

  • Hi!
    I have a site builder created using the flexible content field. I would like to use this field in other groups. When I’m cloning this field in other groups it’s possible to pull out an array with e.g. get_fields(‘sections’) – unfortunately, as you can see, this array is nested, which makes it impossible to loop it with
    while ( have_rows( ‘sections’ ) ): the_row();

    //get_fields() output:
    ["sections"]=>
      array(1) {
        ["sections"]=>
        array(1) {
          [0]=>
          array(5) {
            ["acf_fc_layout"]=>
            string(11) "my_section"
            (...) // rest of fields
          }
        }
      }
    }
    (...) // rest of fields
    

    Is there any possibility to use this loop? I’d like to be able to extract the fields of individual sections using get_sub_field(), using the foreach loop on array will force me to rework all my sections. Is there a workaround? I would be grateful for any suggestions.

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

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.