Created
February 23, 2021 14:50
-
-
Save nikitasinelnikov/f1000bdfe93d7184fabc33d7d570cae5 to your computer and use it in GitHub Desktop.
JobBoardWP: Change job data in AJAX response on the jobs list
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
/** | |
* A job's custom data | |
* | |
* @param array $data | |
* @param WP_Post $job_post | |
* | |
* @return array | |
**/ | |
function jb_custom_job_data( $data, $job_post ) { | |
$data = [ | |
'title' => $job_post->post_title, | |
'permalink' => get_permalink( $job_post ), | |
'date' => JB()->common()->job()->get_posted_date( $job_post->ID ), | |
'expires' => JB()->common()->job()->get_expiry_date( $job_post->ID ), | |
'company' => [ | |
'name' => $job_company_data['name'], | |
'website' => $job_company_data['website'], | |
'tagline' => $job_company_data['tagline'], | |
'twitter' => $job_company_data['twitter'], | |
'facebook' => $job_company_data['facebook'], | |
'instagram' => $job_company_data['instagram'], | |
], | |
'logo' => JB()->common()->job()->get_logo( $job_post->ID ), | |
'location' => $formatted_location, | |
'types' => $data_types, | |
'actions' => [], | |
]; | |
return $data; | |
}; | |
add_filter( 'jb_jobs_job_data_response', 'jb_custom_job_data', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment