Quick Starter Guid¶
Warning
Before creating any form, make sure you have Advanced Custom Fields installed and activated
In this starter guid, we’ll create a form which creates a post with extra fields related to a book. These fields are :
- Book’s ISBN
- Book’s Author
- Date of publication
Creating The Fields¶
First of all, we need to create those extra fields using Advanced Custom Fields (ACF), to do so, in the ACF menu click on “Add New”, this will create a new Fields Group which we’ll call “About the book”.
Then, add the fields using the button “Add Field” :
Label | Name | Type |
---|---|---|
ISBN | isbn | Text |
Author | author | Text |
Date of publication | date_of_publication | Date Picker |
When you have done, click on “Publish”. Now the fields are ready to use.
Adding the form into a page¶
Now we have a ACF Fields Group, we can add a form into any page in our website, let’s create a page in Wordpress and call it “Books Reviw”.
- In this page, click on Edit with Elementor
- From the Elementor panel, find the ACF Form element under the ACF Front Form group
- In the Post ID field, set the value to
new_post
, this means that each time a user submits the form, a new post will be created
- Now, in the Form section, find the Submit Value and set it to
Submit
, this is the text displayed on the submit button of the Form
- You can now Save the settings and preview your page
Add a specific form¶
In some situations, you can have multiple Fields Groups of ACF, in this case we need to tell ACF Front Form to load only our specific Fields Group. To do so, go to ACF Front Form Elementor settings of your page, in the Fields section, in the Field Groups field, check the the group you want to use.
Tip
If you want to add the title and content fields into the Form, then check the two options Show the title and Show the content
Save changes and that’s it !