Make WordPress Core

Ticket #34093: 34093.patch

File 34093.patch, 2.5 KB (added by sebastian.pisula, 9 years ago)
  • wp-includes/general-template.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    16311631        if ( !is_array($cache) )
    16321632                $cache = array();
    16331633
     1634        $post_type = apply_filters('get_calendar_post_type', 'post');
     1635
    16341636        // Quick check. If we have no posts at all, abort!
    16351637        if ( !$posts ) {
    1636                 $gotsome = $wpdb->get_var("SELECT 1 as test FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' LIMIT 1");
     1638                $gotsome = $wpdb->get_var("SELECT 1 as test FROM $wpdb->posts WHERE post_type = '".$post_type."' AND post_status = 'publish' LIMIT 1");
    16371639                if ( !$gotsome ) {
    16381640                        $cache[ $key ] = '';
    16391641                        wp_cache_set( 'get_calendar', $cache, 'calendar' );
     
    16741676        $previous = $wpdb->get_row("SELECT MONTH(post_date) AS month, YEAR(post_date) AS year
    16751677                FROM $wpdb->posts
    16761678                WHERE post_date < '$thisyear-$thismonth-01'
    1677                 AND post_type = 'post' AND post_status = 'publish'
     1679                AND post_type = '".$post_type."' AND post_status = 'publish'
    16781680                        ORDER BY post_date DESC
    16791681                        LIMIT 1");
    16801682        $next = $wpdb->get_row("SELECT MONTH(post_date) AS month, YEAR(post_date) AS year
    16811683                FROM $wpdb->posts
    16821684                WHERE post_date > '$thisyear-$thismonth-{$last_day} 23:59:59'
    1683                 AND post_type = 'post' AND post_status = 'publish'
     1685                AND post_type = '".$post_type."' AND post_status = 'publish'
    16841686                        ORDER BY post_date ASC
    16851687                        LIMIT 1");
    16861688
     
    17361738        // Get days with posts
    17371739        $dayswithposts = $wpdb->get_results("SELECT DISTINCT DAYOFMONTH(post_date)
    17381740                FROM $wpdb->posts WHERE post_date >= '{$thisyear}-{$thismonth}-01 00:00:00'
    1739                 AND post_type = 'post' AND post_status = 'publish'
     1741                AND post_type = '".$post_type."' AND post_status = 'publish'
    17401742                AND post_date <= '{$thisyear}-{$thismonth}-{$last_day} 23:59:59'", ARRAY_N);
    17411743        if ( $dayswithposts ) {
    17421744                foreach ( (array) $dayswithposts as $daywith ) {
     
    17541756                ."FROM $wpdb->posts "
    17551757                ."WHERE post_date >= '{$thisyear}-{$thismonth}-01 00:00:00' "
    17561758                ."AND post_date <= '{$thisyear}-{$thismonth}-{$last_day} 23:59:59' "
    1757                 ."AND post_type = 'post' AND post_status = 'publish'"
     1759                ."AND post_type = '".$post_type."' AND post_status = 'publish'"
    17581760        );
    17591761        if ( $ak_post_titles ) {
    17601762                foreach ( (array) $ak_post_titles as $ak_post_title ) {