Ticket #3110: 3110.diff
File 3110.diff, 3.9 KB (added by , 18 years ago) |
---|
-
wp-includes/general-template.php
323 323 $afterafter = $after; 324 324 foreach ( $arcresults as $arcresult ) { 325 325 $url = get_month_link($arcresult->year, $arcresult->month); 326 if ( $show_post_count ) {327 $text = sprintf('%s %d', $wp_locale->get_month($arcresult->month), $arcresult->year);326 $text = sprintf('%s %d', $wp_locale->get_month($arcresult->month), $arcresult->year); 327 if ( $show_post_count ) 328 328 $after = ' ('.$arcresult->posts.')' . $afterafter; 329 } else {330 $text = sprintf('%s %d', $wp_locale->get_month($arcresult->month), $arcresult->year);331 }332 329 echo get_archives_link($url, $text, $format, $before, $after); 333 330 } 334 331 } … … 338 335 $afterafter = $after; 339 336 foreach ($arcresults as $arcresult) { 340 337 $url = get_year_link($arcresult->year); 341 if ($show_post_count) { 342 $text = sprintf('%d', $arcresult->year); 338 $text = sprintf('%d', $arcresult->year); 339 if ($show_post_count) 343 340 $after = ' ('.$arcresult->posts.')' . $afterafter; 344 } else {345 $text = sprintf('%d', $arcresult->year);346 }347 341 echo get_archives_link($url, $text, $format, $before, $after); 348 342 } 349 343 } 350 344 } elseif ( 'daily' == $type ) { 351 $arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, DAYOFMONTH(post_date) AS `dayofmonth` FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish'ORDER BY post_date DESC" . $limit);345 $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); 352 346 if ( $arcresults ) { 347 $afterafter = $after; 353 348 foreach ( $arcresults as $arcresult ) { 354 349 $url = get_day_link($arcresult->year, $arcresult->month, $arcresult->dayofmonth); 355 350 $date = sprintf("%d-%02d-%02d 00:00:00", $arcresult->year, $arcresult->month, $arcresult->dayofmonth); 356 351 $text = mysql2date($archive_day_date_format, $date); 352 if ($show_post_count) 353 $after = ' ('.$arcresult->posts.')'.$afterafter; 357 354 echo get_archives_link($url, $text, $format, $before, $after); 358 355 } 359 356 } 360 357 } elseif ( 'weekly' == $type ) { 361 358 $start_of_week = get_option('start_of_week'); 362 $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 FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish'ORDER BY post_date DESC" . $limit);359 $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); 363 360 $arc_w_last = ''; 361 $afterafter = $after; 364 362 if ( $arcresults ) { 365 363 foreach ( $arcresults as $arcresult ) { 366 364 if ( $arcresult->week != $arc_w_last ) { … … 371 369 $arc_week_end = date_i18n($archive_week_end_date_format, $arc_week['end']); 372 370 $url = sprintf('%s/%s%sm%s%s%sw%s%d', get_option('home'), '', '?', '=', $arc_year, '&', '=', $arcresult->week); 373 371 $text = $arc_week_start . $archive_week_separator . $arc_week_end; 372 if ($show_post_count) 373 $after = ' ('.$arcresult->posts.')'.$afterafter; 374 374 echo get_archives_link($url, $text, $format, $before, $after); 375 375 } 376 376 }