For now you can extend built-in form with fields from this set:

  • Company
  • Phone
  • Address
  • Subject

Also you can replace form HTML with shortcode of Contact Form 7 on Plugin's options page. There is guide how to add your inputs manually to form HTML.

Example: How to add new field

First thing to do is to edit ninja-contact-form.php which contains form HTML. Add this new input with new ID to existing HTML right after name input div:

<div class="ncf_form_input_wrapper <?php echo ($theme === 'flat' ? 'ncf_color8' : ''); ?> ncf_phone_number_field">
  <input type="text" name="ncf_phone_number_field" id="ncf_phone_number_field" data-rules="required|numeric" placeholder="Your phone *" data-name="Phone">
</div>

Validation rules for fields are hold in special attribute data-rules, for example in existing name input:

<input type="text" id="ncf_name_field" data-rules="required|min[2]|max[32]" >

You can use any validation rule from this list:

  • required
  • min[x]
  • max[x]
  • matches[value]
  • less[x]
  • greater[x]
  • numeric
  • email

To receive new field in email you need to edit message template (in main.php line 150) to this:

$result = wp_mail(
        @$options['ncf_email'],
        get_bloginfo('name') . ' ' . $options['ncf_email_title'], //__( " Contact Form Submission", 'ninja-contact-form' ),
        'Name: ' .  $_POST['ncf_name_field']  . "\n" .
        'Email: ' .  $_POST['ncf_email_field']  . "\n" .
        'Phone: ' .  $_POST['ncf_phone_number_field']  . "\n" .
        'IP: ' . $ip .
          "\n\n----------------Message-----------------\n\n" .
        $_POST['ncf_message_field'] ,
        $headers
    );

That’s it! You’ve just added new input to your form.