custom field at answer form / step by step guide

8.39K viewsGeneralcustom custom field
0

hi, i’m sorry cause i repeat the same question but i want to know how can i add custom field at answer form (a really step by step guide if is possible).
I read the orders at this link https://anspress.io/resources/faq/anspress-form-and-validation-api/ but i can’t understand where (in which file) to put a code, how to put a code etc.
If you know and you have time please submit a guide about custom fields………thanks for the support.

Unselected an answer
0

is there anybody that uses custom fields into his/her ‘s site?

Answered question
0

is it possible to remove the default field (as i mark it at screenshot)?

Answered question
0

thanks about the example…..where (into which file) i must add this code?

Posted new comment

ok, i found it….to the file “functions.php”

0

Here is an example hook for you 😉

/**
 * A sample hook to add custom fields to answer form.
 *
 * @param array $form Form arguments.
 * @return array
 * @author Rahul ARyan <[email protected]>
 */
function my_custom_answer_fields( $form ) {
 $form['fields']['text_field_1'] = array(
  'name' => __( 'Text field 1' ),
  'desc' => __( 'Description for this field' ),
  // 'type' => 'input', // Default is input text field.
 );
  $form['fields']['textarea_1'] = array(
  'name' => __( 'Textarea 1' ),
  'desc' => __( 'Description for this field' ),
  'type' => 'textarea',
 );
   $form['fields']['select_1'] = array(
  'name'    => __( 'Select 1' ),
  'desc'    => __( 'Select field' ),
  'type'    => 'select',
  'options' => array(
   'val1' => 'Value 1',
   'val2' => 'Value 2',
   'val3' => 'Value 3',
   'val4' => 'Value 4',
  ),
 );
  return $form;
}
add_filter( 'ap_answer_form_fields', 'my_custom_answer_fields' );

Unselected an answer