diff --git a/includes/classes/abstracts/abstract-front-end-form.php b/includes/classes/abstracts/abstract-front-end-form.php index 9b22146..1401050 100644 --- a/includes/classes/abstracts/abstract-front-end-form.php +++ b/includes/classes/abstracts/abstract-front-end-form.php @@ -145,7 +145,7 @@ protected function get_field_label( $id ) { foreach ( $this->fields as $fieldset ) { foreach ( $fieldset['fields'] as $field ) { if ( $field['id'] == $id ) { - return $field['label']; + return $field['label']['text']; } } } @@ -236,6 +236,9 @@ protected function process_fields() { case 'email': $html .= $this->field_input( $id, $label, $default, $description, array_merge( array( 'type' => 'email' ), $attributes ) ); break; + case 'tel': + $html .= $this->field_input( $id, $label, $default, $description, array_merge( array( 'type' => 'tel' ), $attributes ) ); + break; case 'file': $html .= $this->field_input( $id, $label, $default, $description, array_merge( array( 'type' => 'file', 'class' => 'form-file' ), $attributes ) ); $this->attributes = array_merge( array( 'enctype' => 'multipart/form-data' ), $this->attributes ); @@ -676,7 +679,7 @@ protected function uploaded_files() { if ( 'file' == $field['type'] && isset( $_FILES[ $id ] ) ) { $attachment_id = media_handle_upload( $id, 0 ); - if ( is_wp_error( $attachment_id ) ) { + if ( is_wp_error( $attachment_id ) && $_FILES[ $id ]['size'] > 0 ) { $error = apply_filters( 'odin_front_end_form_upload_error_' . $this->id, sprintf( '%s %s.', '' . $this->get_field_label( $id ) . '', $attachment_id->get_error_message() ) ); $this->set_errors( $error ); } else {