Skip to content

Instantly share code, notes, and snippets.

@jclapp23
Created July 25, 2013 13:34
Show Gist options
  • Save jclapp23/6079693 to your computer and use it in GitHub Desktop.
Save jclapp23/6079693 to your computer and use it in GitHub Desktop.
WP_Cal_Demo #3
<?php
$ak_titles_for_day = array();
$ak_post_titles = $wpdb->get_results("SELECT ID, post_title, DAYOFMONTH(post_date) as dom "
."FROM $wpdb->posts "
."WHERE post_date >= '{$thisyear}-{$thismonth}-01 00:00:00' "
."AND post_date <= '{$thisyear}-{$thismonth}-{$last_day} 23:59:59' "
."AND post_type = 'post' AND post_status = 'publish'"
);
if ( $ak_post_titles ) {
foreach ( (array) $ak_post_titles as $ak_post_title ) {
$post_title = esc_attr( apply_filters( 'the_title', $ak_post_title->post_title, $ak_post_title->ID ) );
if ( empty($ak_titles_for_day['day_'.$ak_post_title->dom]) )
$ak_titles_for_day['day_'.$ak_post_title->dom] = '';
if ( empty($ak_titles_for_day["$ak_post_title->dom"]) ) // first one
$ak_titles_for_day["$ak_post_title->dom"] = $post_title;
else
$ak_titles_for_day["$ak_post_title->dom"] .= $ak_title_separator . $post_title;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment