function theme_archive_navigation_months in Archive 7.2
Same name and namespace in other branches
- 5 archive.inc \theme_archive_navigation_months()
- 6 archive.pages.inc \theme_archive_navigation_months()
- 7 archive.pages.inc \theme_archive_navigation_months()
Theme the list of months for the archive navigation.
1 theme call to theme_archive_navigation_months()
- theme_archive_navigation in ./
archive.pages.inc - Theme the archive navigation with years, months and dates by default.
File
- ./
archive.pages.inc, line 308 - Pages for the archive module.
Code
function theme_archive_navigation_months($variables) {
$output = "<ul id=\"archive-months\">\n";
$all_count = 0;
foreach ($variables['date']->months as $month) {
$all_count += $month;
}
$output .= '<li' . ($variables['date']->month ? '' : ' class="selected"') . '>' . l(t('All'), _archive_url($variables['type'], $variables['date']->year), array(
'attributes' => array(
'title' => format_plural($all_count, '1 post', '@count posts'),
),
)) . "</li>\n";
$curr_month = format_date(time(), 'custom', 'n');
$curr_year = format_date(time(), 'custom', 'Y');
foreach (range(1, 12) as $month) {
$posts = !empty($variables['date']->months[$month]) ? $variables['date']->months[$month] : 0;
$class = '';
if ($month == $variables['date']->month) {
$class = ' class="selected"';
}
elseif ($curr_year == $variables['date']->year && $month > $curr_month) {
$class = ' class="future"';
}
$month_names = array(
'',
'Jan',
'Feb',
'Mar',
'Apr',
'May',
'Jun',
'Jul',
'Aug',
'Sep',
'Oct',
'Nov',
'Dec',
);
$output .= "<li{$class}>" . ($posts > 0 ? l(t($month_names[$month]), _archive_url($variables['type'], $variables['date']->year, $month), array(
'attributes' => array(
'title' => format_plural($posts, "1 post", "@count posts"),
),
)) : t($month_names[$month])) . "</li>\n";
}
$output .= "</ul>\n";
return $output;
}