fbpx
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-json so 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

<?php

$args = array(
    // Whether the title should be displayed or not (true/false)
    'display_title' => false,
    
    // Whether the description should be displayed or not (true/false)
    'display_description' => false,
    
    // Text used for the submit button
    'submit_text' => 'Submit',
    
    // The URL to which the form points. Defaults to the current URL which will automatically display a success message after submission
    // If this is overriden you may use af_has_submission to check for a form submission
    'target' => CURRENT_URL,
    
    // Whether the form output should be echoed or returned	
    'echo' => true,
    
    // Field values to pre-fill. Should be an array with format: $field_name_or_key => $field_prefill_value
    'values' => array(),
    
    // Array of field keys or names to exclude from form rendering
    'exclude_fields' => array(),
    
    // Either 'wp' or 'basic'. Whether to use the Wordpress media uploader or a regular file input for file/image fields.
    'uploader' => 'wp',
    
    // The URL to redirect to after a successful submission. Defaults to false for no redirection.
    'redirect' => false,
);

advanced_form( 'form_key', $args ); ?>					

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.

About the author

Phil Kurth is a WordPress developer based in Melbourne, Australia. Phil has built countless ACF-powered websites & systems for businesses & agencies of all different sizes. Phil is the author of the popular ACF Custom Database Tables plugin and when he isn’t working he enjoys spending time outdoors with his two young sons.

Keep up to date with all things ACF!

Subscribe to our newsletter or follow @awesomeacf on Twitter!