Make WordPress Core


Ignore:
Timestamp:
09/07/2006 05:38:43 PM (20 years ago)
Author:
ryan
Message:

Honor show_post_count. Props westi. fixes #3110

File:
1 edited

Legend:

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

    r4171 r4172  
    326326                        foreach ( $arcresults as $arcresult ) {
    327327                                $url    = get_month_link($arcresult->year,      $arcresult->month);
    328                                 if ( $show_post_count ) {
    329                                         $text = sprintf('%s %d', $wp_locale->get_month($arcresult->month), $arcresult->year);
     328                                $text = sprintf('%s %d', $wp_locale->get_month($arcresult->month), $arcresult->year);
     329                                if ( $show_post_count )
    330330                                        $after = ' ('.$arcresult->posts.')' . $afterafter;
    331                                 } else {
    332                                         $text = sprintf('%s %d', $wp_locale->get_month($arcresult->month), $arcresult->year);
    333                                 }
    334331                                echo get_archives_link($url, $text, $format, $before, $after);
    335332                        }
    … …  
    341338            foreach ($arcresults as $arcresult) {
    342339                            $url = get_year_link($arcresult->year);
    343                                 if ($show_post_count) {
    344                     $text = sprintf('%d', $arcresult->year);
     340                $text = sprintf('%d', $arcresult->year);
     341                                if ($show_post_count)
    345342                    $after = ' ('.$arcresult->posts.')' . $afterafter;
    346                 } else {
    347                     $text = sprintf('%d', $arcresult->year);
    348                 }
    349343                echo get_archives_link($url, $text, $format, $before, $after);
    350344            }
    351345                }                       
    352346        } elseif ( 'daily' == $type ) {
    353                 $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);
     347                $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);
    354348                if ( $arcresults ) {
     349                        $afterafter = $after;
    355350                        foreach ( $arcresults as $arcresult ) {
    356351                                $url    = get_day_link($arcresult->year, $arcresult->month, $arcresult->dayofmonth);
    357352                                $date = sprintf("%d-%02d-%02d 00:00:00", $arcresult->year, $arcresult->month, $arcresult->dayofmonth);
    358353                                $text = mysql2date($archive_day_date_format, $date);
     354                                if ($show_post_count)
     355                                        $after = ' ('.$arcresult->posts.')'.$afterafter;
    359356                                echo get_archives_link($url, $text, $format, $before, $after);
    360357                        }
    … …  
    362359        } elseif ( 'weekly' == $type ) {
    363360                $start_of_week = get_option('start_of_week');
    364                 $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);
     361                $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);
    365362                $arc_w_last = '';
     363                $afterafter = $after;
    366364                if ( $arcresults ) {
    367365                                foreach ( $arcresults as $arcresult ) {
    … …  
    374372                                                $url  = sprintf('%s/%s%sm%s%s%sw%s%d', get_option('home'), '', '?', '=', $arc_year, '&', '=', $arcresult->week);
    375373                                                $text = $arc_week_start . $archive_week_separator . $arc_week_end;
     374                                                if ($show_post_count)
     375                                                        $after = ' ('.$arcresult->posts.')'.$afterafter;
    376376                                                echo get_archives_link($url, $text, $format, $before, $after);
    377377                                        }
Note: See TracChangeset for help on using the changeset viewer.