How to create an Admin Form:
- Click New Admin Form button on the dashboard:
- Choose the Post Type to which the form will be associated:
Then Admin Form's name and the label will be generated and filled automatically, but you can also edit it
How to add fields into Admin Forms
All Admin Form's fields have to be placed in special groups. There is one necessary group called "Main Form Fields" - the group that hosts the standard WordPress fields. This group adds automatically. All the other fields added in the Main Form Fields group will not be displayed in WordPress.
To create another group:
- Click Add Group button
Enter group’s name (must be unique for all fields and groups of the form being edited) and label
Now you can add fields only inside the group by clicking the Add field button inside of created group:
You must specify the field name (name), which is selected from a list of names of class properties (for example, the post type) associated with the form. Fields with some controls may not be associated with properties, such as buttons. For such fields, you can specify an arbitrary name that does not match the property names of the associated class and is unique within the form.
Name of the field (label) - which will be the sign to the field.
Field description (description).
Control. By default, you specify a control String that corresponds to a simple text field. However, depending on the type of property that the field is associated with, you can select other control options that will be used in the form to retrieve data from the user for the selected property.
Required. If the checkbox is selected, the field is required and the form will not be saved, the user will not fill in this field.
There are several built-in fields for the post Type:
- post_title - the title of the post
- post_content - the text of the post
- post_excerpt - quote
- thumbnail - thumbnail image
- post_date - the creation date of the post
These fields are related to the corresponding post properties. To use them, you must add them as properties with the appropriate names when describing the post Type.
In the form, they can be added as well as any other fields.
Displaying the Admin Form in WordPress:
Once you have created an Admin Form and uploaded the generated plugin to your site, this form will appear in WordPress while you editing Admin list's column:
Go to your created Admin List:
Click the edit column button:
There you can find your Admin Form and edit it: