Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function json_import() {
- $api = new Careerjet_API('en_GB') ;
- $page = 1 ; # Or from parameters.
- $result = $api->search(array(
- 'keywords' => 'php developer',
- 'location' => 'USA',
- 'page' => $page ,
- 'affid' => 'hiddenforexample',
- ));
- if ( $result->type == 'JOBS' ){
- $jobs = $result->jobs ;
- foreach( $jobs as $job ){
- $new_post = array(
- 'post_title' => $job->title,
- 'post_content' => $job->description,
- 'post_status' => 'publish',
- 'post_author' => 1,
- 'post_type' => 'career',
- );
- wp_insert_post($new_post);
- }
- }
- }
Add Comment
Please, Sign In to add comment