forked from caslay/tiny_theme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
archive.php
52 lines (44 loc) · 1.43 KB
/
archive.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
<?php
get_header();
?>
<div class="container">
<header class="title">
<h2><?php single_month_title('<br />'); ?></h2>
</header>
<div class="posts">
<?php if(have_posts()) : while(have_posts()) : the_post(); ?>
<?php if ( is_sticky() ): ?>
<article id='<?php the_ID(); ?>' <?php post_class('sticky'); ?> >
<?php else: ?>
<article id='<?php the_ID(); ?>' <?php post_class(); ?> >
<?php endif; ?>
<h2><a href="<?php the_permalink() ?>"><?php the_title() ?></a></h2>
<?php the_excerpt() ?>
</article>
<?php endwhile; ?>
</div>
<div class="pagination">
<?php
global $wp_query;
$total = $wp_query->max_num_pages;
// only bother with the rest if we have more than 1 page!
if ( $total > 1 ) {
// get the current page
if ( !$current_page = get_query_var('paged') )
$current_page = 1;
// structure of "format" depends on whether we're using pretty permalinks
$format = get_option('permalink_structure')?'page/%#%/':'&page=%#%';
echo paginate_links(array(
'base' => get_pagenum_link(1) . '%_%',
'format' => $format,
'current' => $current_page,
'total' => $total,
'mid_size' => 4,
'type' => 'plain'
));
}
?>
</div>
<?php endif; ?>
</div>
<?php get_footer()?>