Create Custom Fields in the Hub
In this article, you will learn how to create custom fields in the Purple Hub. You will create a new field group, assign it to a post type, create a custom field and then set it as mandatory. In our example, we will create a custom field for recipes, where the author of a post can select whether a recipe is vegan, vegetarian, or contains fish/meat. Here is what the result will look like:
- Have the 'Administrator' role in your Purple Hub
- Have the 'CPT UI' plugin enabled in your Purple Hub
- Have the 'ACF' plugin enabled in your Purple Hub
Read this external article from WordPress to learn more about the concept of Custom fields.
Read this external documentation to learn more about the abilities of the integrated Plugin 'Advanced Custom Fields (ACF) Pro'.
1. Go to Purple Hub
2. Click on 'ACF'
3. Click on 'Field Groups'
4. Click on 'Add New'
5. Next to 'Add New Field Group' type the desired name for your field group into the form, e.g. 'Recipe information'.
6. Click on 'Add Field'
7. Below 'Field Type' choose the desired UI for your custom field from the dropdown, e.g. Radio Buttons
8. Below 'Field Label' insert the Desired Name of the field that will be displayed to the author creating your article. E.g. Diet
9. Below 'Choices' enter your desired choices for the radio buttons.
Put the labels for the system on the left side in lowercase letters and separate the line with an empty space + ':' + another empty space and put on the right side the labels that will be displayed on your post to the readers. For each label, use a new line, so that it looks like in the screenshot.
10. Go back up to the top of the tab and click on 'Validation'
11. Next to 'Required' move the toggle from the left to the right side.
12. Go to 'Settings' -> 'Location Rules' -> 'Show this field if' select 'Post Type' from the dropdown
13. In the following field, select 'is equal to' from the dropdown
14. In the following field, select 'Article' from the dropdown
15. Click on 'Save Changes'
You have now successfully created a new field group, assigned it to a post type and created a custom field coming from a list with radio buttons. You have saved it and your editors will see this (mandatory) field below the article in the UI when editing it.