-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcorrected-shortcode.php
More file actions
138 lines (122 loc) · 7.72 KB
/
Copy pathcorrected-shortcode.php
File metadata and controls
138 lines (122 loc) · 7.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
<?php
// CORRECTED SHORTCODE - Replace your current one with this
function resume_upload_form_shortcode() {
ob_start();
// Handle form submission
if ( isset($_POST['resume_upload_nonce']) && wp_verify_nonce($_POST['resume_upload_nonce'], 'resume_upload_action') ) {
echo '<div style="background: #d4edda; border: 1px solid #c3e6cb; color: #155724; padding: 15px; margin: 20px 0; border-radius: 4px;">';
echo '<strong>✅ Form Submitted Successfully!</strong><br>';
echo 'Form data received:<br>';
foreach ($_POST as $key => $value) {
if ($key !== 'resume_upload_nonce' && !empty($value)) {
echo '<strong>' . esc_html($key) . ':</strong> ' . esc_html(substr($value, 0, 100)) . (strlen($value) > 100 ? '...' : '') . '<br>';
}
}
echo '</div>';
}
?>
<div style="max-width: 800px; margin: 20px auto; padding: 20px; background: white; border: 1px solid #ddd; border-radius: 8px;">
<h3 style="color: #333; margin-top: 0;">📄 Smart Resume Application Form</h3>
<div style="background: #e7f3ff; border: 1px solid #007cba; padding: 15px; margin-bottom: 20px; border-radius: 4px;">
<strong>💡 How to use the Smart Resume Parser:</strong>
<ul style="margin: 10px 0; padding-left: 20px;">
<li><strong>Double-click</strong> any field below to upload your resume</li>
<li><strong>Press Ctrl+U</strong> while focused on any field</li>
<li><strong>Drag & drop</strong> your resume file onto any field</li>
<li>The form will automatically fill with your resume data!</li>
</ul>
</div>
<form method="post" enctype="multipart/form-data" style="max-width: 600px;">
<?php wp_nonce_field('resume_upload_action', 'resume_upload_nonce'); ?>
<div style="margin-bottom: 20px;">
<label for="applicant_name" style="display: block; font-weight: bold; margin-bottom: 5px;">Full Name *</label>
<input type="text"
name="applicant_name"
id="applicant_name"
class="resume-parser-field"
placeholder="Double-click here or press Ctrl+U to upload resume and auto-fill"
required
style="width: 100%; padding: 12px; border: 2px solid #007cba; border-radius: 4px; font-size: 14px;">
<small style="color: #666;">Try double-clicking this field to upload your resume!</small>
</div>
<div style="margin-bottom: 20px;">
<label for="applicant_email" style="display: block; font-weight: bold; margin-bottom: 5px;">Email Address *</label>
<input type="email"
name="applicant_email"
id="applicant_email"
class="resume-parser-field"
placeholder="Double-click here or press Ctrl+U to upload resume and auto-fill"
required
style="width: 100%; padding: 12px; border: 2px solid #007cba; border-radius: 4px; font-size: 14px;">
</div>
<div style="margin-bottom: 20px;">
<label for="applicant_phone" style="display: block; font-weight: bold; margin-bottom: 5px;">Phone Number</label>
<input type="tel"
name="applicant_phone"
id="applicant_phone"
class="resume-parser-field"
placeholder="Double-click here or press Ctrl+U to upload resume and auto-fill"
style="width: 100%; padding: 12px; border: 2px solid #007cba; border-radius: 4px; font-size: 14px;">
</div>
<div style="margin-bottom: 20px;">
<label for="work_experience" style="display: block; font-weight: bold; margin-bottom: 5px;">Work Experience</label>
<textarea name="work_experience"
id="work_experience"
class="resume-parser-field"
placeholder="Double-click here or press Ctrl+U to upload resume and auto-fill with your experience"
style="width: 100%; padding: 12px; border: 2px solid #007cba; border-radius: 4px; font-size: 14px; height: 120px; resize: vertical;"></textarea>
</div>
<div style="margin-bottom: 20px;">
<label for="education" style="display: block; font-weight: bold; margin-bottom: 5px;">Education Background</label>
<textarea name="education"
id="education"
class="resume-parser-field"
placeholder="Double-click here or press Ctrl+U to upload resume and auto-fill with your education"
style="width: 100%; padding: 12px; border: 2px solid #007cba; border-radius: 4px; font-size: 14px; height: 100px; resize: vertical;"></textarea>
</div>
<div style="margin-bottom: 20px;">
<label for="skills" style="display: block; font-weight: bold; margin-bottom: 5px;">Skills & Qualifications</label>
<textarea name="skills"
id="skills"
class="resume-parser-field"
placeholder="Double-click here or press Ctrl+U to upload resume and auto-fill with your skills"
style="width: 100%; padding: 12px; border: 2px solid #007cba; border-radius: 4px; font-size: 14px; height: 100px; resize: vertical;"></textarea>
</div>
<!-- Optional: Traditional file upload as backup -->
<details style="margin: 20px 0; padding: 15px; background: #f8f9fa; border: 1px solid #dee2e6; border-radius: 4px;">
<summary style="cursor: pointer; font-weight: bold; color: #495057;">📎 Alternative: Traditional File Upload</summary>
<div style="margin-top: 15px;">
<label for="resume_file_backup" style="display: block; font-weight: bold; margin-bottom: 5px;">Upload Resume File (PDF/DOC/DOCX)</label>
<input type="file"
name="resume_file_backup"
id="resume_file_backup"
accept=".pdf,.doc,.docx"
style="width: 100%; padding: 8px; border: 1px solid #ccc; border-radius: 4px;">
<small style="color: #666;">This is for users who prefer traditional file upload</small>
</div>
</details>
<div style="margin-top: 30px;">
<input type="submit"
value="Submit Application"
style="background: #007cba; color: white; padding: 15px 30px; border: none; border-radius: 4px; font-size: 16px; cursor: pointer; font-weight: bold;">
</div>
</form>
</div>
<script>
jQuery(document).ready(function($) {
// Add visual feedback for parser fields
$('.resume-parser-field').on('focus', function() {
$(this).css('border-color', '#28a745');
$(this).attr('title', 'Smart field: Double-click, Ctrl+U, or drag resume file to auto-fill');
}).on('blur', function() {
$(this).css('border-color', '#007cba');
});
// Log when fields are ready
console.log('Form ready - Found', $('.resume-parser-field').length, 'smart parser fields');
});
</script>
<?php
return ob_get_clean();
}
add_shortcode('resume_upload_form', 'resume_upload_form_shortcode');
?>