Guest User

Untitled

a guest
Dec 13th, 2017
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. function json_import() {
  2.  
  3. $api = new Careerjet_API('en_GB') ;
  4. $page = 1 ; # Or from parameters.
  5.  
  6. $result = $api->search(array(
  7. 'keywords' => 'php developer',
  8. 'location' => 'USA',
  9. 'page' => $page ,
  10. 'affid' => 'hiddenforexample',
  11. ));
  12.  
  13. if ( $result->type == 'JOBS' ){
  14. $jobs = $result->jobs ;
  15.  
  16. foreach( $jobs as $job ){
  17.  
  18. $new_post = array(
  19. 'post_title' => $job->title,
  20. 'post_content' => $job->description,
  21. 'post_status' => 'publish',
  22. 'post_author' => 1,
  23. 'post_type' => 'career',
  24. );
  25.  
  26. wp_insert_post($new_post);
  27.  
  28. }
  29. }
  30. }
Add Comment
Please, Sign In to add comment