Skip to content

Instantly share code, notes, and snippets.

@nathanaelphilip
Created August 20, 2014 21:45
Show Gist options
  • Save nathanaelphilip/b316332664b03063f717 to your computer and use it in GitHub Desktop.
Save nathanaelphilip/b316332664b03063f717 to your computer and use it in GitHub Desktop.
phrets_hourly is the WP_CRON hook
add_action('phrets_hourly', 'run_listings_update' );
function run_listings_update(){
$fetch = new Fetcher();
$fetch->fetch();
}
// This is the code inside the $fetch object that is run.
public function put(){
$title = $this->create_title($this->data);
// setup the 'post' data
$post = array(
'post_type' => 'listing',
'post_title' => $title,
'post_content' => $this->data['Remarks'],
'post_status' => 'publish'
);
// add new meta data
if (!is_wp_error($post_id)) {
$this->add_meta_data($post_id);
$this->assign_community($post_id,$data);
}
// set the action
$action = 'inserted';
return $action;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment