Toolset allows you to create front-end forms for creating new posts. If those posts are in a one-to-one or one-to-many post relationship, the form can feature a field for selecting the parent post of the one being created.
For example, you could have custom post types for “Events” and “Venues.” An event can have only one venue, whereas a venue can be used for many events. Your front-end form for creating events can feature a field for selecting a venue for the event being created.
Here we describe cases in which the post-relationship is either one-to-many or one-to-one. Visit the related documentation if you need to create forms for connecting posts in a many-to-many relationship.
First, let’s see a case where you create a form for submitting child posts (i.e. events) but you want to allow users to select a parent post of their choosing.
Once your post relationship is created, go to the Toolset → Post Forms page and create a new form. The usage is the same for forms that create new posts and the ones that edit existing posts.
When you create a new form, the element for the post relationship will be a part of the form by default.
If you need to insert the parent selector field manually for existing forms, go to the Form Editor section and drag-and-drop relationship in question to desired location.
That’s it! Now, when users create new posts and select their parent posts, the posts will be connected.
When using forms to create child posts, the parent post will often be known. For example, you might have a button to add an Event to a Venue currently being displayed, as shown in the following example.
Follow these steps:
- Edit the Content Template for the parent post type (i.e. Venue).
- Insert the Toolset Fields and Text block and inside its editor, click the Forms button.
- In the pop-up dialog, click Create Child Post Link.
- Another dialog appears where you have to select the options for your link.
- In the Parent post section, make sure to select the option Set the parent according to the currently displayed content.
That’s it! Now, when a user clicks to add a child post, the form will automatically select the parent.
Display standard and custom fields
- Enabling Additional WooCommerce Fields in Product Forms
- Using Post Reference Field to Set-Up One-to-Many Relationships
- How to set up Post Relationships in WordPress
- Front-End Forms for Connecting Related Posts
- Displaying Related Posts
- Show all related topics...
- What Are Post Relationships and How They Work
- Many-to-Many Post Relationships in WordPress
- Displaying Form Data
- Allow users to manage their items
- Charge users for submitting content
- Extending Form Functionality with Hooks
- Styling Front-End Forms
- Setting up Automatic Post Expiration
- Controlling Access to Front-End Forms
- Adding Generic Fields to Forms
- Send Notifications when Someone Submits the Form
- Deleting Content from The Front-End
- Front-end Forms for Editing Content
- Front-end Forms for Adding Content
- Using the Native Media Manager in Front-End Forms
- Protecting Forms from Spam
- Front-end Forms For Repeatable Field Groups
- Selecting allowed tags in front-end forms
- Letting Forms Edit Post and User Fields Created by Other Plugins
- Conditional Display for Form Inputs