/
block.cwm_archives.php
59 lines (38 loc) · 1.43 KB
/
block.cwm_archives.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php if ( !defined( 'HABARI_PATH' ) ) { die('No direct access'); } ?>
<?php
if ( count( $content->archives ) == 0 ) {
return;
}
else {
?>
<div id="archives" class="block-container">
<div class="wrap">
<h3 class="block-title">Archives</h3>
<?php
echo '<ul>';
$i = 1;
foreach ( $content->archives as $archive ) {
if ( $i == 1 ) {
$class = 'class="first-child"';
}
else if ( $i == count( $content->archives ) ) {
$class = 'class="last-child"';
}
else {
$class = '';
}
$date = HabariDateTime::date_create()->set_date( $archive->year, $archive->month, 1 );
$url = URL::get( 'display_entries_by_date', array( 'year' => $date->format('Y'), 'month' => $date->format('m') ) );
$text = $date->format('F') . ', ' . $date->format('Y');
$title = _t( _n( '%d Post', '%d Posts', $archive->ct ), array( $archive->ct ) );
echo '<li ' . $class . '><a href="' . $url . '" title="' . $text . '">' . $text . '</a><span class="post-count dotipsy leftwards" title="' . $title . '">' . $archive->ct . '</span></li>';
$i++;
}
echo '</ul>';
?>
<a href="<?php echo Site::get_url( 'habari' ); ?>/archives" class="more-archives" title="More archives...">More archives...</a>
</div>
</div>
<?php
}
?>