Home Forums Front-end Issues How to Display all fields in a group Reply To: How to Display all fields in a group

  • this is the code I got working for anyone interested…

        private function display_field_selects(){
            $field_group_key = 'group_5b9b435363912';
            $fields = acf_get_fields($field_group_key);
            echo '<form id="category_filter">';
            foreach ($fields as $field => $data){
                echo '<div class="category_wrapper">';
                echo '<p class="field_label">'.$data['label'].'</p>';
                echo '<select id="ms_'.$data['name'].'" multiple>';
                foreach ($data['choices'] as $key => $value ){
                    echo '<option value="'.$value.'">'.$key.'</option>';  
                echo '</select>';
                echo '</div>';
            echo '</form>';

    This pulls the correct field group data and creates a dropdown select for each field and its options. I believe it will work only on Radio and Checkboxes.

    The next phase for me now is to either get the field_key automatically or create a function that can retrieve the appropriate field_group_key from a predetermined list.

    Thanks John!