Make WordPress Core


Ignore:
Timestamp:
05/07/2010 05:01:29 AM (16 years ago)
Author:
nacin
Message:

Fix start of week and SQL WEEK handling. props mdawaffe, fixes #10397.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/general-template.php

    r14486 r14499  
    966966        }
    967967    } elseif ( 'weekly' == $type ) {
    968         $start_of_week = get_option('start_of_week');
    969         $query = "SELECT DISTINCT WEEK(post_date, $start_of_week) AS `week`, YEAR(post_date) AS yr, DATE_FORMAT(post_date, '%Y-%m-%d') AS yyyymmdd, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY WEEK(post_date, $start_of_week), YEAR(post_date) ORDER BY post_date DESC $limit";
     968        $week = _wp_mysql_week( '`post_date`' );
     969        $query = "SELECT DISTINCT $week AS `week`, YEAR( `post_date` ) AS `yr`, DATE_FORMAT( `post_date`, '%Y-%m-%d' ) AS `yyyymmdd`, count( `ID` ) AS `posts` FROM `$wpdb->posts` $join $where GROUP BY $week, YEAR( `post_date` ) ORDER BY `post_date` DESC $limit";
    970970        $key = md5($query);
    971971        $cache = wp_cache_get( 'wp_get_archives' , 'general');
Note: See TracChangeset for help on using the changeset viewer.