Support

Account

Home Forums Front-end Issues Group 'if' statement to not show fields with no value Reply To: Group 'if' statement to not show fields with no value

  • Hi @aaronrobb

    A simple if statement will work for you like so:

    
    <?php $fields = get_fields();
    
      $fields = get_field_objects();
    
      if( $fields )
      {
        foreach( $fields as $field_name => $field )
        {
        	if( $field['value'] )
        	{
    		      echo '<dl>';
    		        echo '<dt>' . $field['label'] . '</dt>';
    		        echo '<dd>' . $field['value'] . '</dd>';
    		      echo '</dl>';
          	}
        }
      }
    
    ?>