forked from JoshuaD84/dhara-theme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharchive.php
72 lines (65 loc) · 2.3 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php get_header(); ?>
<div class="page-content archive">
<h1> <?php wp_title(""); ?> </h1>
<?php
show_archive_pagination($wp_query);
if (have_posts()) {
$start = ($posts_per_page * (get_query_var('paged') - 1) + 1);
if ($start < 1) {
$start = 1;
}
while (have_posts()) {
the_post();
if (!is_restricted()) {
?>
<article class="archive">
<header class="archive">
<h2 class="archive">
<a href="<?php echo get_page_link(); ?>"><?php echo get_the_title(); ?></a>
</h2>
<strong><?php the_time(get_option('date_format')); ?></strong>
</header>
<p class="archive">
<?php echo get_the_excerpt(); ?>
</p>
<footer class="archive">
<img class="post-metadata-icon" width="14" height="14"
alt="" src="<?php bloginfo('template_directory'); ?>/images/postcategoryicon.png" /> Posted in <?php the_category(', ') ?>
</footer>
</article>
<?php
}
}
show_archive_pagination($wp_query);
} else {
?>
<h3>Sorry, no matching pages found.</h3>
<?php
}
?>
</div>
<?php get_footer();
function show_archive_pagination($wp_query) {
if ($wp_query->max_num_pages >= 2) {?>
<section class="pagination-links archive">
<hr />
<nav class="pagination archive">
<?php
$big = 999999999;
echo paginate_links(array(
'base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))),
'format' => '?paged=%#%',
'show_all' => false,
'end_size' => "16",
'mid_size' => "8",
'prev_text' => "« Newer",
'next_text' => "Older »",
'current' => max(1, get_query_var('paged')),
'total' => $wp_query->max_num_pages
));
?>
</nav>
<hr />
</section>
<?php }
}