How to use Advanced Custom Fields for your contact forms
I’d like to introduce you to a new extension for ACF called ‘Advanced Forms’.
I’d like to introduce you to a new extension for ACF called ‘Advanced Forms’.
Advanced Forms helps you create “Flexible and developer-friendly forms using the power of ACF”
In my opinion this is the most under-rated extension for ACF, you should really check it out!
If you’re creating custom WordPress themes for clients, I’m guessing you’ll be using ACF Pro to manage your custom fields and a form plugin like Gravity Forms to manage your contact forms.
In my experience, most client sites don’t really need a complex form builder plugin. Some developers think ACF is just for the wp-admin area. However, ACF is more then capable of managing the front end forms needed on most client sites!
You may have heard of the acf_form function, it lets you easily display an ACF field group(s) on the front end of your site. Over the last few years I’ve used it to create all kinds of front end forms and applications. It’s great however it requires quite a lot of custom development for something like a simple contact form.
Advanced Forms solves this, it extends the default acf_form functionality and it makes creating all kinds of front end forms really easy!
It was created by a Swedish developer, Fabian, after chatting to him last week I found out he’s running it in production on a range of his client sites & he’s in contact with a close network of developers that also use the plugin daily on their client sites.
What are the benefits ?
-
It’s easy to style (and looks great out of the box)
-
It’s free, well documented and really easy to implement
-
Hundreds of field options (repeaters, maps, colour pickers, etc)
-
Entry data can easily be stored within WP
-
Multiple email notifications can be easily setup for each form
-
Data could be saved to (draft) custom post types instead of entries
-
Conditional logic is includeed as it’s just a normal ACF Field group
-
Works well with
acf-jsonso you can keep your form in version control -
Forms can even be embedded with a [shortcode] if that’s your style
-
Forms can be created programmatically
-
Leverage all the core & custom validation functionally of ACF
Any downsides at the moment ?
-
Integrating third party services like Slack, Campaign Monitor or MailChimp will require a little custom development
-
There are no eCommerce / Payment field options at the moment, this would require custom development.
-
There’s no easy way to implement paged forms at the moment
Screenshots
Example Implementation
Summary
I can highly recommend the Advanced Forms plugin, it’s available for free from the WordPress.org repo and the documentation can be found on GitHub.
The Pro Version
Advanced Forms has evolved significantly since this article was written. Advanced Forms Pro by Hookturn adds submissions storage, email notifications, multi-step forms, and more. View the extension on Awesome ACF.