Skip to content

Instantly share code, notes, and snippets.

@jclapp23
Created July 25, 2013 13:30
Show Gist options
  • Save jclapp23/6079633 to your computer and use it in GitHub Desktop.
Save jclapp23/6079633 to your computer and use it in GitHub Desktop.
WP_Cal_Demo # 1
<?php
// Get days with posts
$dayswithposts = $wpdb->get_results("SELECT DISTINCT DAYOFMONTH(post_date)
FROM $wpdb->posts WHERE post_date >= '{$thisyear}-{$thismonth}-01 00:00:00'
AND post_type = 'post' AND post_status = 'publish'
AND post_date <= '{$thisyear}-{$thismonth}-{$last_day} 23:59:59'", ARRAY_N);
if ( $dayswithposts ) {
foreach ( (array) $dayswithposts as $daywith ) {
$daywithpost[] = $daywith[0];
}
} else {
$daywithpost = array();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment