Tell us what you are trying to do?
I've created a Post type named "Job Order", where the users can submit new job order by a form at the front-end, then they can display the Job Order in View loop and Template.
I'm trying to do:
First:
An auto incremental unique number ex; 101, 102,103.. etc. for each submitted Job Order, As an ID..
Second:
I want to display this unique number (or ID) in the View loop and Template.
If it possible also, do searching by this ID.
--------------------------------------------------------------------------
Another different thing:
I would like to print the Job Order after submitted as it is designed in the template in (Arabic Language), any suggestion?
--------------------------------------------------------------------------
NOTE: I'm not good enough with coding!.
My greeting;
Thank you.
add_action('cred_save_data', 'func_set_post_id_as_unique_id',10,2);
function func_set_post_id_as_unique_id($post_id, $form_data) {
if ($form_data['id']==99999){
$field_slug = 'order-id';
update_post_meta($post_id,'wpcf-'.$field_slug , $post_id);
}
}
Where:
- Replace 99999 with your original Form ID.
Technically every post ID is unique so the above code will help you to set post ID as order ID and later you can use the custom field order id to search as well.