Add yearly archive display option. Props stewart and westi. fixes #2352
git-svn-id: https://develop.svn.wordpress.org/trunk@4138 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
886be0b0bd
commit
b17c5d427b
|
@ -332,6 +332,21 @@ function wp_get_archives($args = '') {
|
||||||
echo get_archives_link($url, $text, $format, $before, $after);
|
echo get_archives_link($url, $text, $format, $before, $after);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} elseif ('yearly' == $type) {
|
||||||
|
$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);
|
||||||
|
if ($arcresults) {
|
||||||
|
$afterafter = $after;
|
||||||
|
foreach ($arcresults as $arcresult) {
|
||||||
|
$url = get_year_link($arcresult->year);
|
||||||
|
if ($show_post_count) {
|
||||||
|
$text = sprintf('%d', $arcresult->year);
|
||||||
|
$after = ' ('.$arcresult->posts.')' . $afterafter;
|
||||||
|
} else {
|
||||||
|
$text = sprintf('%d', $arcresult->year);
|
||||||
|
}
|
||||||
|
echo get_archives_link($url, $text, $format, $before, $after);
|
||||||
|
}
|
||||||
|
}
|
||||||
} elseif ( 'daily' == $type ) {
|
} elseif ( 'daily' == $type ) {
|
||||||
$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);
|
$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);
|
||||||
if ( $arcresults ) {
|
if ( $arcresults ) {
|
||||||
|
|
Loading…
Reference in New Issue