Skip to content

Instantly share code, notes, and snippets.

@yousufansa
Created January 14, 2019 16:29
Show Gist options
  • Save yousufansa/caf8fafc299495eeaaf6bc82907eef98 to your computer and use it in GitHub Desktop.
Save yousufansa/caf8fafc299495eeaaf6bc82907eef98 to your computer and use it in GitHub Desktop.
Job Overview Custom Field Display Example
if( ! function_exists( 'jh_child_single_job_overview_details' ) ) {
function jh_child_single_job_overview_details( $args ) {
$args['job_salary'] = array( /* field name without prefix _ (underscore) - you can find the field name by inspecting that field in add new job on WP Admin Panel */
'icon' => 'la la-money', /* Replace "la la-money" with Your Icon Class. */
'label' => esc_html__( 'Job Salary', 'jobhunt' ), /* Replace "Job Salary" with Your Field Title. */
'callback' => 'jh_child_single_job_overview_job_salary', /* Add the field name with the prefix jh_child_single_job_overview */
);
return $args;
}
}
add_filter( 'jobhunt_single_job_overview_details', 'jh_child_single_job_overview_details' );
if( ! function_exists( 'jh_child_single_job_overview_job_salary' ) ) { /* Add the field name with the prefix jh_child_single_job_overview */
function jh_child_single_job_overview_job_salary() { /* Add the field name with the prefix jh_child_single_job_overview */
$post = get_post();
if ( ! $post || 'job_listing' !== $post->post_type ) {
return;
}
echo isset( $post->_job_salary ) ? $post->_job_salary : ''; /* field name */
}
}
@yousufansa
Copy link
Author

Example to Get Field Name:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment