Click to initialize TinyMCE
In this guide we’ll learn how to create a dummy Post Title & Post Content fields for the front-end form. In fact, ACF Extended doesn’t create these fields in order to give you full control over fields types (text, textarea, editor…), their settings (required, max length…) and their placement in the form.
#Using the Field Group UI
Create a dummy Field Group with the “Title” and the “Content” fields. Set the Field Group as disabled so it’s never displayed in the back-end.
Then in the Form UI, map the dummy Field Group and the actual Form Field Group. All fields will become available in the Actions UI.
The unique form slug
Render & map fields of the following field groups
Add actions on form submission
Apply field groups locations rules for front-end display
Whether or not to create a <form>
element
Form class and id
Add class to all fields
Whether or not to create a form submit button. Defaults to true
The text displayed on the submit button
HTML used to render the submit button loading spinner.
Whether to include a hidden input field to capture non human form submission. Defaults to true.
Whether or not to sanitize all $_POST data with the wp_kses_post() function. Defaults to true.
Whether to use the WP uploader or a basic input for image and file fields. Defaults to 'wp' Choices of 'wp' or 'basic'.
Determines element used to wrap a field. Defaults to 'div'
Determines where field labels are places in relation to fields. Defaults to 'top'.
Choices of 'top' (Above fields) or 'left' (Beside fields)
Determines where field instructions are places in relation to fields. Defaults to 'label'.
Choices of 'label' (Below labels) or 'field' (Below fields)
Override the native field groups HTML render
Extra HTML to add before the fields
Render your own customized HTML.
Extra HTML to add after the fields
Choose where to display field errors
Add class to error message
Retrieve actions output
Last Term Action | |
---|---|
{action:term:ID} | 23 |
{action:term:post_title} | Term |
{action:term:admin_url} | https://www.acf-extended.com/wp-admin/term.php?tag_ID=23 |
{action:term:permalink} | https://www.acf-extended.com/taxonomy/term |
See {term} for all available tags |
Term Action Named my-term | |
---|---|
{action:my-term:ID} | 23 |
{action:my-term:post_title} | Term |
{action:my-term:admin_url} | https://www.acf-extended.com/wp-admin/term.php?tag_ID=23 |
{action:my-term:permalink} | https://www.acf-extended.com/taxonomy/term |
See {term} for all available tags |
Retrieve actions output
Last User Action | |
---|---|
{action:user:ID} | 1 |
{action:user:user_login} | login |
{action:user:user_email} | [email protected] |
{action:user:user_url} | https://www.website.com |
{action:user:permalink} | https://www.acf-extended.com/author/johndoe |
See {user} for all available tags |
User Action Named my-user | |
---|---|
{action:my-user:ID} | 1 |
{action:my-user:user_login} | login |
{action:my-user:user_email} | [email protected] |
{action:my-user:user_url} | https://www.website.com |
{action:my-user:permalink} | https://www.acf-extended.com/author/johndoe |
See {user} for all available tags |
Retrieve actions output
Last Email Action | |
---|---|
{action:email:from} | Contact |
{action:email:to} | [email protected] |
{action:email:reply_to} | [email protected] |
{action:email:cc} | [email protected] |
{action:email:bcc} | [email protected] |
{action:email:subject} | Subject |
{action:email:content} | Content |
Email Action Named my-email | |
---|---|
{action:my-email:from} | Contact |
{action:my-email:to} | [email protected] |
{action:my-email:reply_to} | [email protected] |
{action:my-email:cc} | [email protected] |
{action:my-email:bcc} | [email protected] |
{action:my-email:subject} | Subject |
{action:my-email:content} | Content |
#Using a Local Field Group
Alternatively, if you don’t want to pollute your Field Groups UI list with a dummy Field Group, you could export it in PHP, paste the code in your theme’s functions.php
file and forget it. It will be always available for any form you create.
Here is one you can use:
add_action('acf/init', 'my_acfe_form_title_content');
function my_acfe_form_title_content(){
acf_add_local_field_group(array(
'key' => 'group_my_acfe_form_title_content',
'title' => 'Title + Content',
'fields' => array(
array(
'key' => 'field_title',
'label' => 'Title',
'name' => 'title',
'type' => 'text',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '',
'class' => '',
'id' => '',
),
'default_value' => '',
'maxlength' => '',
'placeholder' => '',
'prepend' => '',
'append' => '',
),
array(
'key' => 'field_content',
'label' => 'Content',
'name' => 'content',
'type' => 'textarea',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '',
'class' => '',
'id' => '',
),
'default_value' => '',
'maxlength' => '',
'rows' => '',
'placeholder' => '',
'new_lines' => '',
),
),
'location' => array(),
'menu_order' => 0,
'position' => 'normal',
'style' => 'default',
'label_placement' => 'left',
'instruction_placement' => 'label',
'hide_on_screen' => '',
'active' => false,
'description' => '',
'show_in_rest' => 0,
));
}
An alternative method is to add the Title & Content fields directly in the Field Group mapped in your form. You can then hide them in the back-end using your preferred method.