I’ve created a custom post type for employees in a company with some fields they have to fill (like E-mail, phone, etc.) and a select box which takes some values from another custom post type called “company”. I’ve disabled / removed the editor for the employee post type but now I’m having trouble listing them in the overview because each “employee” misses a title (post_title). How can I set the post_title for an employee to be equal to the custom field “Name”?
There is a lot of code working so I’ll only show the part where I’m saving my data for each employee:
foreach ($meta_box['fields'] as $field) {
if(isset($_POST[$field['id']])) {
if(!add_post_meta($post_id, $field['id'], $_POST[$field['id']], true)) update_post_meta($post_id, $field['id'], $_POST[$field['id']]);
}
}
I have an array with all the data and then save with the right values for each field but can I here say, that:
If($field[‘id’] == ‘emp_name’) {
Set($post_title = $field[‘id’]);
}
Or something like that?
Any help or suggestions would be very much appreciated.
Thank you - Mestika