-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample-shortcode-fix.php
More file actions
106 lines (88 loc) · 4.73 KB
/
Copy pathexample-shortcode-fix.php
File metadata and controls
106 lines (88 loc) · 4.73 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
<?php
// CORRECTED VERSION - Add this to your theme's functions.php
function resume_upload_form_shortcode() {
ob_start();
if ( isset($_POST['resume_upload_nonce']) && wp_verify_nonce($_POST['resume_upload_nonce'], 'resume_upload_action') ) {
if ( ! function_exists('wp_handle_upload') ) {
require_once( ABSPATH . 'wp-admin/includes/file.php' );
}
$uploadedfile = $_FILES['resume_file'];
$upload_overrides = array( 'test_form' => false );
$movefile = wp_handle_upload( $uploadedfile, $upload_overrides );
if ( $movefile && ! isset( $movefile['error'] ) ) {
echo '<p style="color:green;">Resume uploaded successfully: <a href="' . esc_url($movefile['url']) . '" target="_blank">View</a></p>';
} else {
echo '<p style="color:red;">Error: ' . $movefile['error'] . '</p>';
}
}
?>
<form method="post" enctype="multipart/form-data">
<?php wp_nonce_field('resume_upload_action', 'resume_upload_nonce'); ?>
<h3>📄 Smart Resume Parser Form</h3>
<p><em>Tip: Double-click any field below, press Ctrl+U, or drag a resume file onto the fields to auto-fill!</em></p>
<!-- THESE are the fields that should have resume-parser-field class -->
<p>
<label for="applicant_name">Full Name:</label><br>
<input type="text" name="applicant_name" id="applicant_name" class="resume-parser-field"
placeholder="Enter your name or drag resume file here" style="width: 100%; padding: 8px;">
</p>
<p>
<label for="applicant_email">Email:</label><br>
<input type="email" name="applicant_email" id="applicant_email" class="resume-parser-field"
placeholder="Enter your email or drag resume file here" style="width: 100%; padding: 8px;">
</p>
<p>
<label for="applicant_phone">Phone:</label><br>
<input type="tel" name="applicant_phone" id="applicant_phone" class="resume-parser-field"
placeholder="Enter your phone or drag resume file here" style="width: 100%; padding: 8px;">
</p>
<p>
<label for="work_experience">Work Experience:</label><br>
<textarea name="work_experience" id="work_experience" class="resume-parser-field"
placeholder="Describe your experience or drag resume file here"
style="width: 100%; padding: 8px; height: 120px;"></textarea>
</p>
<p>
<label for="education">Education:</label><br>
<textarea name="education" id="education" class="resume-parser-field"
placeholder="Your education background or drag resume file here"
style="width: 100%; padding: 8px; height: 80px;"></textarea>
</p>
<p>
<label for="skills">Skills:</label><br>
<textarea name="skills" id="skills" class="resume-parser-field"
placeholder="List your skills or drag resume file here"
style="width: 100%; padding: 8px; height: 80px;"></textarea>
</p>
<!-- OPTIONAL: Keep the traditional file upload as backup -->
<details style="margin: 20px 0;">
<summary>📎 Traditional File Upload (Alternative)</summary>
<p style="margin-top: 10px;">
<label for="resume_file">Or upload resume file traditionally:</label><br>
<input type="file" name="resume_file" id="resume_file" accept=".pdf,.doc,.docx">
</p>
</details>
<p>
<input type="submit" value="Submit Application" style="background: #007cba; color: white; padding: 10px 20px; border: none; border-radius: 4px; cursor: pointer;">
</p>
</form>
<script>
// Add helpful tooltips
jQuery(document).ready(function($) {
$('.resume-parser-field').each(function() {
const $field = $(this);
const originalTitle = $field.attr('title') || '';
$field.attr('title', 'Smart Resume Parser: Double-click, Ctrl+U, or drag resume file here to auto-fill');
});
});
</script>
<?php
return ob_get_clean();
}
add_shortcode('resume_upload_form', 'resume_upload_form_shortcode');
// ALSO ADD: Debug shortcode (as we added to the main plugin)
add_shortcode('resume_debug', 'resume_parser_debug_standalone');
function resume_parser_debug_standalone() {
return '<div style="background: #ffffcc; padding: 15px; border: 1px solid #ffcc00; margin: 20px 0;"><strong>🔍 Debug Info:</strong><br>Add <code>[resume_parser_debug]</code> to see detailed diagnostics of the resume parser.</div>';
}
?>