Changeset 21610
- Timestamp:
- 08/24/2012 08:50:22 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/general-template.php
r21597 r21610 870 870 'format' => 'html', 'before' => '', 871 871 'after' => '', 'show_post_count' => false, 872 'echo' => 1 872 'echo' => 1, 'order' => 'DESC', 873 873 ); 874 874 … … 883 883 $limit = ' LIMIT '.$limit; 884 884 } 885 886 $order = strtoupper( $order ); 887 if ( $order !== 'ASC' ) 888 $order = 'DESC'; 885 889 886 890 // this is what will separate dates on weekly archive links … … 910 914 911 915 if ( 'monthly' == $type ) { 912 $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";916 $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"; 913 917 $key = md5($query); 914 918 $cache = wp_cache_get( 'wp_get_archives' , 'general'); … … 932 936 } 933 937 } elseif ('yearly' == $type) { 934 $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";938 $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"; 935 939 $key = md5($query); 936 940 $cache = wp_cache_get( 'wp_get_archives' , 'general'); … … 953 957 } 954 958 } elseif ( 'daily' == $type ) { 955 $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";959 $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"; 956 960 $key = md5($query); 957 961 $cache = wp_cache_get( 'wp_get_archives' , 'general'); … … 976 980 } elseif ( 'weekly' == $type ) { 977 981 $week = _wp_mysql_week( '`post_date`' ); 978 $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";982 $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"; 979 983 $key = md5($query); 980 984 $cache = wp_cache_get( 'wp_get_archives' , 'general');
Note: See TracChangeset
for help on using the changeset viewer.