Home Forums Add-ons Flexible Content Field Get subfield label dynamically Reply To: Get subfield label dynamically

  • I also would like print out the layout label, but “get_sub_field_object” hasn’t helped me, maybe I’m using it wrong.
    Made it in two ways: ACF style “has_sub_field” and also more PHP style `$fields = get_field(‘flexible’);
    foreach($fields as $field)…`

    Printing out flexible content field (“get_field” and “get_field_object”) gives me a large array and I can see it’s contents, but I don’t get, how [value] is related to [layouts]. Therefore I cannot get the layout label.

    Could you advise me on how to get it?
    Since I’m using flexible->repeater->repeater with complicated HTML, I would much more prefer “foreach” style.

    Thank you 🙂