array(
'name' => __('Europass Resumes'),
'singular_name' => __('Europass Resume')
),
'public' => false, // It's false because we don't need public archive
'show_ui' => true,
'supports' => array('title', 'custom-fields'),
'capability_type' => 'post',
)
);
}
add_action('init', 'create_resume_post_type');
// 2. Main Shortcode Function
function europass_resume_builder_shortcode() {
// Check if we're processing a form submission
if (isset($_POST['submit_europass_resume']) && wp_verify_nonce($_POST['europass_nonce'], 'save_europass_resume')) {
return process_resume_form();
}
// Check if we're downloading a resume
if (isset($_GET['download_resume']) && isset($_GET['resume_id'])) {
return handle_resume_download(intval($_GET['resume_id']));
}
// Show the main form
return display_resume_form();
}
add_shortcode('europass_resume_builder', 'europass_resume_builder_shortcode');
// 3. Display the Form
function display_resume_form() {
wp_enqueue_style('europass-form-css');
wp_enqueue_script('europass-form-js');
ob_start();
?>
Security check failed. Please try again.
';
}
$current_user = wp_get_current_user();
$resume_data = array(
'post_title' => sanitize_text_field($_POST['first_name'] . ' ' . $_POST['last_name']),
'post_type' => 'europass_resume',
'post_status' => 'publish',
'post_author' => $current_user->ID
);
$resume_id = wp_insert_post($resume_data);
if (is_wp_error($resume_id)) {
return 'Error saving your resume. Please try again.
';
}
// Save all fields
$fields_to_save = array(
'first_name', 'last_name', 'address', 'phone', 'email', 'nationality',
'mother_tongue', 'digital_skills'
);
foreach ($fields_to_save as $field) {
if (isset($_POST[$field])) {
update_post_meta($resume_id, $field, sanitize_text_field($_POST[$field]));
}
}
// Save array fields (work experience, education, languages)
$array_fields = array(
'work_dates', 'work_position', 'work_employer', 'work_activities',
'education_dates', 'education_qualification', 'education_subjects', 'education_organization',
'language_name', 'language_understanding', 'language_speaking', 'language_writing'
);
foreach ($array_fields as $field) {
if (isset($_POST[$field])) {
$sanitized_values = array_map('sanitize_text_field', $_POST[$field]);
update_post_meta($resume_id, $field, $sanitized_values);
}
}
// Return success message with download/payment options
ob_start();
?>
Your Europass Resume has been saved!
You can now download your resume in PDF format.
Download PDF (Free Preview)
Premium Download
Get the official Europass formatted PDF with watermark removed.