Support

Account

Home Forums Front-end Issues Absolute display of all fields Reply To: Absolute display of all fields

  • Hi @vguenichon

    Here’s some code that I managed to get working to display details about the sub fields within a repeater:

    Note: I left my debugging statements intact, but commented out.

    
    <?php
     // repeater field - this can be set dynamically within your loop of course... I set it statically for testing
      $field_obj = get_field_object( 'field_59dbae70e1416' );
    
      if ( $field_obj ) {
        if ( $field_obj['type'] == 'repeater' ) {
    
     // the array of sub fields within the repeater
          $sub_fields = $field_obj['sub_fields'];
    
          foreach( $sub_fields as $sub_field ) {
            echo '<p>key: ' . $sub_field['key'] . '<br />';
            echo 'label: ' . $sub_field['label'] . '<br />';
            echo 'name: ' . $sub_field['name'] . '</p>';
          }
          //echo '<pre>';
          //print_r($sub_fields);
          //echo '</pre>';
        }
      }
    ?>