We are working on a huge update to the Types plugin, which is for now available as a beta release you can use for test purposes. The upcoming version is bringing a completely redesigned and rewritten post relationships, introducing the repeating group of fields feature and further streamlining the Types user interface in general.
Watch the following video for an overview of the new features:
Beta release is for testing purposes only
This Types beta release is only supposed to be used for testing, exploring, and experimenting purposes. It is a work in progress, and many features are still missing.
- It is recommended to use the alpha release with a fresh WordPress install and sample contents that you do not expect to keep for later production work.
- This alpha release is meant to be used as a standalone plugin as it does not yet work with Toolset or WPML.
- The user interface and the backend is fully functional and all the structures like custom post types and relationships are indeed created and stored in the database.
Are you taking Types alpha for a spin? Please, use the comments section at the bottom to share your thoughts and experience or report any bugs and usability issues. Thank you!
Creating repeatable field groups
Repeatable field groups is one of the biggest new features of this upcoming Types release. Besides allowing you to make a whole group of fields repeatable, it also enables you to nest repeatable groups inside other repeatable groups. This truly empowers you to create any custom fields structure you can imagine.
Repeatable group of fields can be added to any standard group of field, including Post, User and Term:
- Go to the Toolset -> Custom fields page and click to Add New custom fields group.
- Select whether you want to create Post, User, or Term fields.
- Name your main field group and save it.
- To be able to insert a repeatable group of fields, your main group needs to be assigned to a single post type. Click the Edit button in the Where to include this Field Group section and select one post type.
- Now, you click the Add New Repeatable Group button, name the repeatable group and start adding fields to it.
You can nest repeatable groups inside other repeatable groups with no limit to the number of nesting levels.
Now, when you edit the related posts, you can add as many instances of the repeatable fields as you need. You can also reorder and delete them, if needed.
Creating post type relationships
The new version of Types features a native way for creating many-to-many relationships between post types.
There are three types of relationships you can create:
- One-to-one – for example, one Person can only have one Passport.
- One-to-many – for example, one Writer can be author of many Books.
- Many-to-many – for example, many bands can perform on many Events.
The first step of creating a relationship is to create the necessary post types. You can do this from the already-familiar Toolset -> Post Types page. The creation of custom post types is exactly the same as in the current, stable Types release.
Now, visit the Toolset -> Relationship page to create post relationships or edit the existing ones. Click on the Add New button and follow the wizard for creating post relationships:
- Select the relationship type.
- Select the post types you want to connect.
- If needed, set the maximum number of posts that can be related to the other post at once.
- Give the relationship a name and select the options for the intermediary post type.
- Review the relationship summary and click Finish to create it.
The role of intermediary post types
When creating post type relationships, an intermediary post type is usually created. These post types serve as a connection between the post types that you are adding the relations to. Additionally, you can add custom fields to the intermediary post type used for many-to-many relationships.
For example, if you have “Festivals” and “Performers”, a performer can appear on many festivals and a festival has many performers. In this case you can have an intermediary post type of “appearances” and it can make sense to add a “Date of appearance” custom field to it. This allows you to query your Performers and Festivals and display the related date of appearance when needed.
In the new version of Types, the intermediary post types are created automatically, but you still have control over it:
- You can customize their names.
- For one-to-one and one-to-many relationships, you can select whether the intermediary post types are created at all.
- You can select whether the intermediary post type is shown in the WordPress admin. It is hidden by default.
Using the relationships when editing related posts
Once your post relationship is created, you can create new related posts right from the parent’s editing page.