Created
January 14, 2019 16:29
-
-
Save yousufansa/caf8fafc299495eeaaf6bc82907eef98 to your computer and use it in GitHub Desktop.
Job Overview Custom Field Display Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 */ | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example to Get Field Name:
