function theme_archive_navigation_months in Archive 5
Same name and namespace in other branches
- 6 archive.pages.inc \theme_archive_navigation_months()
- 7.2 archive.pages.inc \theme_archive_navigation_months()
- 7 archive.pages.inc \theme_archive_navigation_months()
Theme the list of months for the archive navigation.
Parameters
$type: A string representing the node-type currently being displayed
$date: A date object returned from _archive_date()
1 theme call to theme_archive_navigation_months()
- theme_archive_navigation in ./
archive.inc - Theme the archive navigation with years, months and dates by default.
File
- ./
archive.inc, line 237
Code
function theme_archive_navigation_months($type, $date) {
$output = "<ul id=\"archive-months\">\n";
$all_count = 0;
foreach ($date->months as $month) {
$all_count += $month;
}
$output .= '<li' . ($date->month ? '' : ' class="selected"') . '>' . l(t('All'), _archive_url($type, $date->year), array(
'title' => format_plural($all_count, '1 post', '@count posts'),
)) . "</li>\n";
$curr_month = date('n', time());
$curr_year = date('Y', time());
$month_names = _get_month_names();
foreach (range(1, 12) as $month) {
$posts = !empty($date->months[$month]) ? $date->months[$month] : 0;
$class = '';
if ($month == $date->month) {
$class = ' class="selected"';
}
elseif ($curr_year == $date->year && $month > $curr_month) {
$class = ' class="future"';
}
$output .= "<li{$class}>" . ($posts > 0 ? l($month_names[$month], _archive_url($type, $date->year, $month), array(
'title' => format_plural($posts, '1 post', '@count posts'),
)) : $month_names[$month]) . "</li>\n";
}
$output .= "</ul>\n";
return $output;
}