Changeset 388 for trunk/b2-include/b2template.functions.php
- Timestamp:
- 09/26/2003 07:03:35 AM (22 years ago)
- File:
-
- 1 edited
-
trunk/b2-include/b2template.functions.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/b2-include/b2template.functions.php
r377 r388 122 122 } 123 123 124 function get_archives($type='', $limit='', $format='html', $before = "", $after = "" ) {124 function get_archives($type='', $limit='', $format='html', $before = "", $after = "", $show_post_count = false) { 125 125 global $tableposts, $dateformat, $time_difference, $siteurl, $blogfilename; 126 126 global $querystring_start, $querystring_equal, $querystring_separator, $month, $wpdb, $start_of_week, $querycount; … … 162 162 if ('monthly' == $type) { 163 163 ++$querycount; 164 $arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month` FROM $tableposts WHERE post_date < '$now' AND post_category > 0 AND post_status = 'publish'ORDER BY post_date DESC" . $limit);164 $arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts FROM $tableposts WHERE post_date < '$now' AND post_category > 0 AND post_status = 'publish' GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC" . $limit); 165 165 if ($arcresults) { 166 166 foreach ($arcresults as $arcresult) { 167 167 $url = sprintf("%s%d%02d", $archive_link_m, $arcresult->year, $arcresult->month); 168 $text = sprintf("%s %d", $month[zeroise($arcresult->month,2)], $arcresult->year); 168 if ($show_post_count) 169 $text = sprintf("%s %d (%d)", $month[zeroise($arcresult->month,2)], $arcresult->year, $arcresult->posts); 170 else 171 $text = sprintf("%s %d", $month[zeroise($arcresult->month,2)], $arcresult->year); 169 172 echo get_archives_link($url, $text, $format, $before, $after); 170 173 }
Note: See TracChangeset
for help on using the changeset viewer.