Problem:
The issue here is that the user wanted to dynamically generate their post title based on the custom field inputs.
Solution:
This can be done by using the hook below.
function ttd_save_data_action($post_id, $form_data){ // Change your CRED Form "ID" accordingly below if ($form_data['id']==ID){ //Declare the content of your variables, change "your_custom_field_slug" accordingly $custom_value = get_post_meta( $post_id, 'wpcf-your_custom_field_slug', true );//get posts' Date field value (timestamp) $custom_title = gmdate("m-d-Y", $custom_value);//convert timestamp to m-d-y for output //collect data and define new title $my_post = array( 'ID' => $post_id, 'post_title' => $custom_title, 'post_name' => $custom_title, ); // Update the post into the database wp_update_post( $my_post ); } } add_action('cred_save_data', 'ttd_save_data_action',10,2);
Ofcourse this will need to be adopted to fit your case but this is generally how it is done
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 |
---|---|---|---|---|---|---|
- | 9:00 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | - |
- | 13:00 – 18:00 | 13:00 – 18:00 | 13:00 – 18:00 | 14:00 – 18:00 | 13:00 – 18:00 | - |
Supporter timezone: America/Jamaica (GMT-05:00)
This topic contains 6 réponses, has 2 voix.
Last updated by paulB-10 Il y a 4 années et 10 mois.
Assisted by: Shane.