Home Forums Front-end Issues Field Groups Reply To: Field Groups

  • Hi @Stingo

    Currently, there is no way to separate the fields into field groups with labels.
    This will be possible in the soon to be released version5, but for now. You will need to hardcode the heading for each field group.

    An easy way to do this is to create an array which contains all the field names for the field group, then loop through that and display the field like so:

    <h2>Field Group Name</h2>
    $fields = array(
    <?php if( $fields ): ?>
    	<?php foreach( $fields as $field ): 
    		$field = get_field_object( $field );
    		<?php if( $field['value'] ): ?>
    			<li><?php echo $field['label']; ?>: <?php echo $field['value']; ?></li>
    		<?php endif; ?>
    	<?php endforeach; ?>
    <?php endif; ?>

    Hope that helps