cpham / acf-contact-form

Contact Form Extension for Advanced Custom Fields (Beta)
61 stars 13 forks source link

Advanced Custom Fields Contact Form Extension (Beta)

This is an extension for Advanced Custom Fields 5 for Wordpress, which enables you to create a contact form using an existing Field Group in ACF. It will also add a new post to a Custom Post Type of your choosing.

Requirements

Future Additions

Supported Fields

Currently, this plugin supports the following fields:

I will add support for all other fields in the future.

Installation

Creating a form

Custom Email Templates

To send emails using a custom HTML template, simply create a template using the_field() and get_field() functions provided by ACF to display the custom field values from the form submission. This feature is helpful if you need to parse the form data before it gets emailed to you.

Example:

 <p><?php the_field('first_name'); ?> <?php the_field('last_name'); ?> has submitted an inquiry.</p>

Akismet Spam Filtering

To enable Akismet validation in your form, add the following classes to the corresponding form fields you would like to validate, under "Wrapper Attributes." You must have Akismet enabled.

Placing a form in your page

To place a form in your page content, use this shortcode, and use the ID number of the Form Rule you want to use from your ACF Form options page. Example: [acf_contact id="1"]. Other parameters for the acf_contact shortcode include:

These parameters are taken from the acf_form() function parameters - please refer to this page for usage: http://www.advancedcustomfields.com/resources/acf_form/

Placing a form in your theme

To use it within your template, add this before any other HTML (before get_header()):

 <?php acf_form_head(); ?>

Then add this where you want the form to appear:

<?php do_shortcode('[acf_contact id="1"]'); ?>