Hello!
Is there a way to echo all available the_field regarding current post, because currently I have something like this
if(the_field('position')) echo the_field('position')
if(the_field('dimension')) echo the_field('dimension')
and with about 50 fields spreaded in different categories it is very difficult to maintain the code, especially since i have to enclose everything inside html styling divs and ul lists
i was hoping to write something like this
foreach(the_field)
if(the_field not empty)
echo the_field
TY
One step simpler would be to put each of the field names into an array and then loop through using your code above:
$my_fields = array('position','dimension','color','weight','etc');
foreach ( $my_fields as $my_field ) {
if ( the_field( $my_field ) ) echo the_field( $my_field );
}
If you want to go one step more complicated, you could try automatically building the array of field names by querying all the fields within a particular field group.