I would like to display all type fields from my ACF field group (text, images, checkbox, wysiwyg, etc..). The problem is when i try to do this, i see Notice ” Array to string conversion” or “Undefined index:…..”. How can i do that?
I try this but its not worked properly:
$fields = get_field_objects();
/* just for show arrays
print_r ($fields) ;
if( $fields )
foreach( $fields as $field_name => $field )
print '<img src="'.$field['value']['url'].'">';
Please help me,
Best regards, Luk
unless every field in an image field then you’ll need to check the type of each field and proceed accordingly to use the correct method to show what you’re looking for.
Not all fields will have $field[‘value’][‘url’]
and print $field[‘value’][‘sizes’] is an array, not really sure about print $field[‘value’][‘0’];
If you just trying to see what’s in them try
print_r() like your commented out code at the top.