Support

Account

Home Forums Front-end Issues Echo all available the_field Reply To: Echo all available the_field

  • 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.