Skip Navigation

[Resolved] Create child form button in php

This support ticket is created 6 years, 6 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 1 reply, has 2 voices.

Last updated by Christian Cox 6 years, 6 months ago.

Assisted by: Christian Cox.

Author
Posts
#958673

I am trying to: Well, Iḿ integrating The events Calendar Plugin in my site, so I created a new custom post type called Registers that have the fields to make a registration to an event. This post type is a child of the events post type created by The events caledar plugin.
So... I created a button were I put a link for create a new child post (register) inside my functions.php, that shows up when someone sees the event. (Because I can't create a layout for this post type because the fields are not recognized

I created a form to create the child post and is inside a page: hidden link

I put this on the button:
echo 'hidden link;" target="_self">Asistiré';

But I can't see the post relationship auto filled.

Is this correct?
_wpcf_belongs_tribe_events_id is the post Id of the event post created, and when I generated the form It appears like that in the parent relationship.

sorry for my bad english.

Regards,

Carlos

#984607

Hi, the _wpcf_belongs_{slug}_id syntax for parent and child post relationships has been deprecated in the new post relationships system, so if your site was created in Types 3.0+, or if you updated to Types 3.0+ and used the post relationships migration tool, then the syntax is different. If you are still using the old post relationship system, then the syntax looks okay, but I'm not sure about the Tribe events post type slug. For example, if the slug of the Tribe Events post type is "tribe-events", then the syntax would be _wpcf_belongs_tribe-events_id

If you're having trouble getting the parent pre-selected using a link created in PHP, try inserting the shortcode using the GUI (with the Toolset Forms button above the text editor), then test it out on the front-end of the site to get the format right. If the link created by the GUI doesn't work, then I'll need to take a closer look.