Ticket #1368: 1368a.diff
File 1368a.diff, 3.9 KB (added by , 17 years ago) |
---|
-
wp-includes/general-template.php
342 342 $add_hours = intval(get_option('gmt_offset')); 343 343 $add_minutes = intval(60 * (get_option('gmt_offset') - $add_hours)); 344 344 345 //filters 346 $where = apply_filters('getarchives_where', "WHERE post_type = 'post' AND post_status = 'publish'", $r ); 347 $join = apply_filters('getarchives_join', "", $r); 348 345 349 if ( 'monthly' == $type ) { 346 $arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish'GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC" . $limit);350 $arcresults = $wpdb->get_results("SELECT DISTINCT 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); 347 351 if ( $arcresults ) { 348 352 $afterafter = $after; 349 353 foreach ( $arcresults as $arcresult ) { … … 355 359 } 356 360 } 357 361 } elseif ('yearly' == $type) { 358 $arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, count(ID) as posts FROM $wpdb->posts WHERE post_type ='post' AND post_status = 'publish'GROUP BY YEAR(post_date) ORDER BY post_date DESC" . $limit);362 $arcresults = $wpdb->get_results("SELECT DISTINCT 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); 359 363 if ($arcresults) { 360 364 $afterafter = $after; 361 365 foreach ($arcresults as $arcresult) { … … 367 371 } 368 372 } 369 373 } elseif ( 'daily' == $type ) { 370 $arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, DAYOFMONTH(post_date) AS `dayofmonth`, count(ID) as posts FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish'GROUP BY YEAR(post_date), MONTH(post_date), DAYOFMONTH(post_date) ORDER BY post_date DESC" . $limit);374 $arcresults = $wpdb->get_results("SELECT DISTINCT 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); 371 375 if ( $arcresults ) { 372 376 $afterafter = $after; 373 377 foreach ( $arcresults as $arcresult ) { … … 381 385 } 382 386 } elseif ( 'weekly' == $type ) { 383 387 $start_of_week = get_option('start_of_week'); 384 $arcresults = $wpdb->get_results("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 WHERE post_type = 'post' AND post_status = 'publish'GROUP BY WEEK(post_date, $start_of_week), YEAR(post_date) ORDER BY post_date DESC" . $limit);388 $arcresults = $wpdb->get_results("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); 385 389 $arc_w_last = ''; 386 390 $afterafter = $after; 387 391 if ( $arcresults ) { … … 402 406 } 403 407 } elseif ( ( 'postbypost' == $type ) || ('alpha' == $type) ) { 404 408 ('alpha' == $type) ? $orderby = "post_title ASC " : $orderby = "post_date DESC "; 405 $arcresults = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' ORDER BY$orderby $limit");409 $arcresults = $wpdb->get_results("SELECT * FROM $wpdb->posts $join $where $orderby $limit"); 406 410 if ( $arcresults ) { 407 411 foreach ( $arcresults as $arcresult ) { 408 412 if ( $arcresult->post_date != '0000-00-00 00:00:00' ) {