Skip to content

Instantly share code, notes, and snippets.

@yousufansa
Created October 5, 2018 09:09
Show Gist options
  • Select an option

  • Save yousufansa/8178b91bc01e9b484d4703637ab6295b to your computer and use it in GitHub Desktop.

Select an option

Save yousufansa/8178b91bc01e9b484d4703637ab6295b to your computer and use it in GitHub Desktop.
Jobhunt Resume Custom Fields
add_action( 'init', 'jobhunt_child_custom_function' );
if ( ! function_exists( 'jobhunt_child_custom_function' ) ) {
function jobhunt_child_custom_function() {
remove_filter( 'submit_resume_form_fields', 'jobhunt_add_custom_submit_resume_form_fields' );
add_filter('resume_manager_resume_fields', 'jobhunt_child_add_custom_resume_fields' );
add_filter('submit_resume_form_fields' , 'jobhunt_child_custom_submit_resume_form_fields');
add_filter( 'jobhunt_single_candidate_overview_details', 'jobhunt_child_single_candidate_overview_details' );
}
}
if ( ! function_exists( 'jobhunt_child_add_custom_resume_fields' ) ) {
function jobhunt_child_add_custom_resume_fields ($fields) {
$fields['_candidate_dob'] = array(
'label' => esc_html__( 'Date of Birth', 'jobhunt' ),
'placeholder' => 'your date of birth'
);
$fields['_candidate_phone'] = array(
'label' => esc_html__( 'Phone', 'jobhunt' ),
'placeholder' => 'your phone number'
);
return $fields;
}
}
if ( ! function_exists( 'jobhunt_child_custom_submit_resume_form_fields' ) ) {
function jobhunt_child_custom_submit_resume_form_fields ($fields) {
unset ($fields['resume_fields']['candidate_title']);
unset ($fields['resume_fields']['candidate_location']);
unset ($fields['resume_fields']['candidate_photo']);
unset ($fields['resume_fields']['candidate_video']);
unset ($fields['resume_fields']['candidate_education']);
unset ($fields['resume_fields']['resume_category']);
unset ($fields['resume_fields']['resume_skills']);
unset ($fields['resume_fields']['links']);
$fields['resume_fields']['candidate_dob'] = array(
'label' => esc_html__( 'Date of Birth', 'jobhunt' ),
'type' => 'date',
'priority' => 6,
'required' => false
);
$fields['resume_fields']['candidate_phone'] = array(
'label' => esc_html__( 'Phone', 'jobhunt' ),
'type' => 'text',
'priority' => 6,
'required' => false
);
$fields['resume_fields']['candidate_awards'] = array(
'label' => esc_html__( 'Certificates', 'jobhunt' ),
'add_row' => esc_html__( 'Add Certificates', 'jobhunt' ),
'type' => 'repeated', // repeated
'required' => false,
'placeholder' => '',
'priority' => 12,
'fields' => array(
'award_title' => array(
'label' => esc_html__( 'Certificate Title', 'jobhunt' ),
'type' => 'text',
'required' => true,
'placeholder' => '',
'description' => ''
),
'date' => array(
'label' => esc_html__( 'Date/Year', 'jobhunt' ),
'type' => 'text',
'required' => true,
'placeholder' => '',
'description' => ''
),
'notes' => array(
'label' => esc_html__( 'Notes', 'jobhunt' ),
'required' => false,
'placeholder' => '',
'description' => '',
'type' => 'textarea',
)
)
);
return $fields;
}
}
if( ! function_exists( 'jobhunt_child_single_candidate_overview_details' ) ) {
function jobhunt_child_single_candidate_overview_details( $args ) {
$args['candidate_dob'] = array(
'icon' => 'la la-calendar',
'label' => esc_html__( 'Date of Birth', 'jobhunt' ),
'callback' => 'jobhunt_child_single_candidate_overview_candidate_dob',
);
$args['candidate_phone'] = array(
'icon' => 'la la-phone',
'label' => esc_html__( 'Phone', 'jobhunt' ),
'callback' => 'jobhunt_child_single_candidate_overview_candidate_phone',
);
return $args;
}
}
if( ! function_exists( 'jobhunt_child_single_candidate_overview_candidate_dob' ) ) {
function jobhunt_child_single_candidate_overview_candidate_dob() {
$post = get_post();
if ( ! $post || 'resume' !== $post->post_type ) {
return;
}
echo isset( $post->_candidate_dob ) ? $post->_candidate_dob : '';
}
}
if( ! function_exists( 'jobhunt_child_single_candidate_overview_candidate_phone' ) ) {
function jobhunt_child_single_candidate_overview_candidate_phone() {
$post = get_post();
if ( ! $post || 'resume' !== $post->post_type ) {
return;
}
echo isset( $post->_candidate_phone ) ? $post->_candidate_phone : '';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment