Schedule Post date and time

Labels

This Discussion is public

Notifications

Using FF to create a form to create post/pages

How to setup front-end posting in WordPress

On the "posting" form

Example: http://russelltours.com/post

Add a date field and a time field (set time field to 24 hours) add a 3rd field for datetime combo.

Make combined datetime field a date format.

See code below.

Add this code to code snippets plugin... https://wordpress.org/plugins/code-snippets/

--------------

add_filter( 'frm_validate_field_entry', 'frm_combine_date_time', 8, 2 );
function frm_combine_date_time( $errors, $posted_field ) {
$date_field = 810; // change 25 to the id of your date field
$time_field = 830; // change 26 to the id of your time field
$combo_field = 831; // change 27 to the id of your hidden combo field
if ( $posted_field->id == $combo_field ) {
$date = FrmProAppHelper::maybe_convert_to_db_date( sanitize_text_field( $_POST['item_meta'][ $date_field ] ), 'Y-m-d' );
$time = sanitize_text_field( $_POST['item_meta'][ $time_field ] );
FrmProTimeField::time_array_to_string( $time );
$time = FrmProAppHelper::format_time( $time, 'H:i:s' );
$_POST['item_meta'][ $combo_field ] = $date . ' ' . $time;
}
return $errors;
}
--------------------
See FF KB:

frm_validate_field_entry


See
"Combine date and time#" section.

In Form Settings for "Create Post" Choose your new combined field "datetime" in the post time setting on your form.


Attachment:

Thanks for sharing

Reply to this Discussion