Contents
Repeater Custom Meta Box Overview
A Repeater Custom Meta Box allows you to add a Repeater Custom Field or a Repeater Custom Field Group to a specific Page, Post or Custom Post Type.
When to use a Repeater Custom Meta Box?
A Repeater Custom Meta Box comes in handy when you want to add multiple Custom Fields or Groups of Custom Fields of the same kind, without knowing the exact number.
It’s useful for situations where the number can vary in time, like for example when you want to create an “Our Team” or “Testimonials” page.
Creating a Repeater Custom Meta Box with Custom Fields
To create a Repeater Custom Meta Box with one or more Custom Fields follow the steps below:
1. From the WCK plugin tab, click on Custom Fields Creator.
2. Click “Add New” to create a new Repeater Custom Meta Box for your Repeater Custom Fields.
3. Add a Custom Meta Box Title (e.g. Event Details) and fill in the Meta Box Arguments. For a Repeater Custom Meta Box make sure to set Repeater to true. When you’re done, go to Meta Box Fields to add your Fields.
Meta Box Arguments:
- Group name (required) – The name of the group. It is the name by which you will query the data in the front-end. Must be unique, only lowercase letters, no spaces and no special characters
- Post Type (required) – What Post Type the Meta Box should be attached to
- Repeater – Whether the Meta Box is a Single Custom Meta Box or Repeater Custom Meta Box. By default it is a Single Meta Box
- Sortable – Whether the entries are sortable or not. This is valid for Repeater Meta Boxes
- Post ID – ID of the post on which the Meta Box should appear
- Page Template – If post type is “page” you can further select a Page Template. The Meta Box will only appear on the page that has that selected Page Template.
4. After, under Meta Box Fields tab insert one (Repeater Field) or more (Repeater Group) Custom Fields, one entry at a time. Make sure you specify a Field Title and a Field Type.
Custom Fields Arguments:
- Field Title (required) – The title of the custom field
- Field Type (required) – The type of the custom field
- Description – The description of the field
- Required – Whether the field is required or not
- Default value – Default value of the field
5. Hit “Publish” and you’re done!
Now, under “Event” post, you’ll have a Repeater Custom Meta Box to insert one or more details about the Event.