I have a number of custom fields that I want to use in a number of post types. e.g. a list of tournaments.
it can be used for player registration (post type) to nominate for a team and it can be used for nominating coaches and managers in another post type.
When you define a custom field you have to assign a CPT for it, otherwise, it is global. This does not work Great if you are trying to build up a hierarchy of fields, essentially an object.
e.g. A person's name is really first name + last name and you will always put them together so I would like to have a field
"Person Name" but not assign it to a post type in the custom field.
When I create a custom post type, create a custom field for the entire CPT e.g. Coach Nominations.
and create a Coach Nomination Custom field in which I would include person name.
See the following example.
CPT Coach Nominations
Custom Field -> Coach Nominations
includes Person Name (custom field) Not assigned to any post.
comprises First Name, Last Name
CPT Player Registrations
Custom Field -> Player Registration
includes Person Name (custom field) Not assigned to any post
comprises First Name, Last Name.
I have thought of creating a dummy CPT that comprises all custom fields but is just a holding object but I am sure there is a better solution.
Thank you in advance for your assistance and guidance.
Hello,
In your case, I don't think there is other better solution.
For example, you can create a custom post type "Member", with custom fields
- Person Name
...
Setup one-to-many(or one-to-one) relationship between post type "Member" and "Coach Nominations",
In a single "Coach Nominations" post, you can display the related "Member" post information by above relationship, see our document:
https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/#displaying-one-related-item-parent
I will take on board the advice for future development of the website.
Thank you!