Help Center

Setting the Auto Parent-Child Relation to Posts Via a Front End Form (Legacy)

Setting the Auto Parent-Child Relation to Posts Via a Front End Form (Legacy)

Create a form for Child posts and display it on a Single template for Parent posts. It will have a required One to Many relation if you insert the relation meta key in the right field of the Form.

Before you start, check the tutorial requirements:

  • Elementor (Free version) or Block editor (Gutenberg)

  • JetEngine plugin installed and activated

    with the Relations (Legacy) configured and the Forms (Legacy) module enabled.

Create a Post Types Relation

Make sure that you do have the necessary post types to be interrelated. If not, create them. We’ll be referring to these two: Country & Tour. To create a relation, go to JetEngine > Relations and set the One to Many relation as shown below:

country tour relation settings

Create a Test Form

Go to JetEngine > Forms > Add New and create a form that allows adding a new post from the frontend:

test form settings

In the Post-submit actions, configure the notification type like so:

form notification settings

The relation meta key can be taken from here:

legacy relations meta key

Display the Form on the Front-end

Open the Tour CPT and find the necessary post in the WordPress dashboard. 

cpt post in the dashboard

If it doesn’t exist, you need to create it either in the Elementor theme builder or in the Crocoblock theme builder:

edit tour single page

Display the newly-created test form:

form in elementor

Fill in the Form

On the front-end, try filling out the added form and press the “Add new post” button:

front end form submission

Go to the backend and check out the result. You’re done!

submitted test post

Was this article helpful?
YesNo

Need help?

Ask Facebook community

Get answers from 22K Crocoblock Community experts from all over the world.

Start a live chat

Ask question to support agent and share its details via chat messages.