<?php $fields = acf_get_fields('6066'); ?> <?php if( $fields ) { foreach( $fields as $field) { $value = get_field( $field['name'] ); if ($value) { echo '<dl>'; echo '<dt>' . $field['label'] . '</dt>'; echo '<dd>' . $field['value'] . '</dd>'; echo '</dl>'; } } } ?> This is what I have. If I do a var_dump on acf_get_fields, it apparently sets the value to NULL. I could have known, as it's written here:
https://www.advancedcustomfields.com/resources/get_field_object/
The problem: I have to first get all fields in a specific field_group, hence I am using acf_get_fields.
I thought with using $field['value'] I could get it to work, but apparently this does not work.
Can someone help me to retrieve the values in the foreach per field? Surely there must be a way, right?
PS:
<?php $fields = get_fields(); if( $fields ): ?> <ul> <?php foreach( $fields as $name => $value ): ?> <li><b><?php echo $name; ?></b> <?php echo $value; ?></li> <?php endforeach; ?> </ul> <?php endif; ?> This gives me ALL fields. I just need a specific list of fields from a specific field group. That is the problem.
I tried all suggestions here: ACF - get fields from group, but none of them do the trick for my case.