Skip to content

Instantly share code, notes, and snippets.

@LinzardMac
Created January 27, 2013 00:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save LinzardMac/4645460 to your computer and use it in GitHub Desktop.
Save LinzardMac/4645460 to your computer and use it in GitHub Desktop.
public function posts_by_day() {
global $json_api;
$oldest = get_posts(array(
'orberby' => 'date',
'order' => 'ASC',
'posts_per_page' => 1,
'caller_get_posts' => 1
));
$years = array_reverse(range(mysql2date('ISO 8601', $oldest[0]->post_date), date('ISO 8601', current_time('timestamp'))));
foreach ($years as $year) {
$year_posts = get_posts(array(
'year' => $year,
'post_type'=> array( 'post', 'imported_content' ),
'order' => 'ASC',
'orderby' => 'post_date',
'posts_per_page' => -1
));
foreach ($year_posts as $year_post) {
return array(
"posts" => $year_posts
);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment