Problem:
How can I set a Post that is submitted with CRED, to be child to the Post, where the Form is inserted?
I also need to update it's title with a value coming from a Post Field
Solution:
You will use a Custom CRED API (cred_save_data) and Wordpress API (mainly get_ and update_post_meta) to achieve this
You will put the function created into your Theme's functions.php
In the Code, you will:
get_post_meta the field's value with which you want to update your Post title
wp_update_post the title with the above value
You must note that the parent post ID in this case will be the ID of the Post where you show the CRED, and this is stored in the CRED API $form_data['container_id'];
With this value you update the posts hidden field _wpcf_belongs_parent-post-slug_id
A good example is visible there:
http://pastebin.com/2BTbVbcs
https://toolset.com/forums/topic/register-for-event/page/2/#post-388619
Relevant Documentation:
https://toolset.com/documentation/user-guides/creating-cred-forms/
https://toolset.com/documentation/user-guides/cred-api/#csd
https://codex.wordpress.org/Child_Themes
https://codex.wordpress.org/Functions_File_Explained
https://codex.wordpress.org/WP_DEBUG
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.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
- | - | 14:00 – 20:00 | 14:00 – 20:00 | 14:00 – 20:00 | 14:00 – 20:00 | 14:00 – 20:00 |
- | - | - | - | - | - | - |
Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)
This topic contains 19 Antworten, has 2 Stimmen.
Last updated by mirjanaM vor 7 Jahre, 5 Monate.
Assigned support staff: Beda.