chrisH-10
Admite hilos creados en los últimos 30 días: 0
Debates favoritos del foro
Este usuario no tiene debates favoritos.
Temas del foro creados
Status | Debate | Supporter | Voces | Mensajes | Caducidad |
---|---|---|---|---|---|
CRED: Create new related post while on parent editing page
Iniciado por: chrisH-10 en: Toolset Professional Support |
2 | 14 | hace 7 años | ||
Create a link to a page that embeds a content edit form
Iniciado por: chrisH-10 en: Toolset Professional Support |
2 | 5 | hace 7 años, 2 meses | ||
Set publish date of post
Iniciado por: chrisH-10
en: Toolset Professional Support
Problem: I would like to set the publish date and time of a post within the CRED Form used to create that post. Solution: There's no post publish date field built into CRED, so this will require some custom code and a generic field. Add a generic date field to your CRED form, then add this code to functions.php: add_action('cred_save_data', 'set_post_date_to', 100, 3); function set_post_date_to($post_id, $form_data) { if( $form_data['id'] == 12345 ) { $newDate = $_POST['set-new-date']['datetime'] . ' 00:00:00'; $my_post = array( 'ID' => $post_id, 'post_date' => $newDate, 'post_date_gmt' => $newDate, 'post_status' => 'future' ); // Update the post into the database wp_update_post( $my_post ); } } - Change the form id 12345 to match your form. Relevant Documentation: |
2 | 5 | hace 7 años, 2 meses |