Ticket #18832: 18832.diff
File 18832.diff, 2.9 KB (added by , 14 years ago) |
---|
-
wp-includes/general-template.php
863 863 'type' => 'monthly', 'limit' => '', 864 864 'format' => 'html', 'before' => '', 865 865 'after' => '', 'show_post_count' => false, 866 'echo' => 1 866 'echo' => 1, 'order' => 'DESC' 867 867 ); 868 868 869 869 $r = wp_parse_args( $args, $defaults ); … … 903 903 $output = ''; 904 904 905 905 if ( 'monthly' == $type ) { 906 $query = "SELECT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC$limit";906 $query = "SELECT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date $order $limit"; 907 907 $key = md5($query); 908 908 $cache = wp_cache_get( 'wp_get_archives' , 'general'); 909 909 if ( !isset( $cache[ $key ] ) ) { … … 925 925 } 926 926 } 927 927 } elseif ('yearly' == $type) { 928 $query = "SELECT YEAR(post_date) AS `year`, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY YEAR(post_date) ORDER BY post_date DESC$limit";928 $query = "SELECT YEAR(post_date) AS `year`, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY YEAR(post_date) ORDER BY post_date $order $limit"; 929 929 $key = md5($query); 930 930 $cache = wp_cache_get( 'wp_get_archives' , 'general'); 931 931 if ( !isset( $cache[ $key ] ) ) { … … 946 946 } 947 947 } 948 948 } elseif ( 'daily' == $type ) { 949 $query = "SELECT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, DAYOFMONTH(post_date) AS `dayofmonth`, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY YEAR(post_date), MONTH(post_date), DAYOFMONTH(post_date) ORDER BY post_date DESC$limit";949 $query = "SELECT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, DAYOFMONTH(post_date) AS `dayofmonth`, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY YEAR(post_date), MONTH(post_date), DAYOFMONTH(post_date) ORDER BY post_date $order $limit"; 950 950 $key = md5($query); 951 951 $cache = wp_cache_get( 'wp_get_archives' , 'general'); 952 952 if ( !isset( $cache[ $key ] ) ) { … … 969 969 } 970 970 } elseif ( 'weekly' == $type ) { 971 971 $week = _wp_mysql_week( '`post_date`' ); 972 $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";972 $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` $order $limit"; 973 973 $key = md5($query); 974 974 $cache = wp_cache_get( 'wp_get_archives' , 'general'); 975 975 if ( !isset( $cache[ $key ] ) ) {