Make WordPress Core

Ticket #15202: general-template.diff

File general-template.diff, 2.4 KB (added by Chouby, 12 years ago)
  • trunk/wp-includes/general-template.php

     
    11291129        $unixmonth = mktime(0, 0 , 0, $thismonth, 1, $thisyear);
    11301130        $last_day = date('t', $unixmonth);
    11311131
     1132        $join = apply_filters( 'getcalendar_join', '' );
     1133        $where = apply_filters( 'getcalendar_where', "AND post_type = 'post' AND post_status = 'publish'" );
     1134
    11321135        // Get the next and previous month and year with at least one post
    11331136        $previous = $wpdb->get_row("SELECT MONTH(post_date) AS month, YEAR(post_date) AS year
    1134                 FROM $wpdb->posts
    1135                 WHERE post_date < '$thisyear-$thismonth-01'
    1136                 AND post_type = 'post' AND post_status = 'publish'
     1137                FROM $wpdb->posts $join
     1138                WHERE post_date < '$thisyear-$thismonth-01' $where
    11371139                        ORDER BY post_date DESC
    11381140                        LIMIT 1");
    11391141        $next = $wpdb->get_row("SELECT MONTH(post_date) AS month, YEAR(post_date) AS year
    1140                 FROM $wpdb->posts
    1141                 WHERE post_date > '$thisyear-$thismonth-{$last_day} 23:59:59'
    1142                 AND post_type = 'post' AND post_status = 'publish'
     1142                FROM $wpdb->posts $join
     1143                WHERE post_date > '$thisyear-$thismonth-{$last_day} 23:59:59' $where
    11431144                        ORDER BY post_date ASC
    11441145                        LIMIT 1");
    11451146
     
    11921193
    11931194        // Get days with posts
    11941195        $dayswithposts = $wpdb->get_results("SELECT DISTINCT DAYOFMONTH(post_date)
    1195                 FROM $wpdb->posts WHERE post_date >= '{$thisyear}-{$thismonth}-01 00:00:00'
    1196                 AND post_type = 'post' AND post_status = 'publish'
    1197                 AND post_date <= '{$thisyear}-{$thismonth}-{$last_day} 23:59:59'", ARRAY_N);
     1196                FROM $wpdb->posts $join
     1197                WHERE post_date >= '{$thisyear}-{$thismonth}-01 00:00:00'
     1198                AND post_date <= '{$thisyear}-{$thismonth}-{$last_day} 23:59:59' $where", ARRAY_N);
    11981199        if ( $dayswithposts ) {
    11991200                foreach ( (array) $dayswithposts as $daywith ) {
    12001201                        $daywithpost[] = $daywith[0];
     
    12101211
    12111212        $ak_titles_for_day = array();
    12121213        $ak_post_titles = $wpdb->get_results("SELECT ID, post_title, DAYOFMONTH(post_date) as dom "
    1213                 ."FROM $wpdb->posts "
     1214                ."FROM $wpdb->posts "
     1215                .$join
    12141216                ."WHERE post_date >= '{$thisyear}-{$thismonth}-01 00:00:00' "
    12151217                ."AND post_date <= '{$thisyear}-{$thismonth}-{$last_day} 23:59:59' "
    1216                 ."AND post_type = 'post' AND post_status = 'publish'"
     1218                .$where
    12171219        );
    12181220        if ( $ak_post_titles ) {
    12191221                foreach ( (array) $ak_post_titles as $ak_post_title ) {