-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy patharchive.php
136 lines (101 loc) · 3.6 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
<?php get_header('', array( 'body-classes' => 'archive-page') ); ?>
<main>
<header>
<!-- <nav class="breadcrumbs">
<ol>
<li><a href=#">Home</a></li>
<li><a href=#">Blog</a></li>
</ol>
</nav> -->
<h1><?php the_archive_title(); ?></h1>
<p><?php the_archive_description(); ?></p>
</header>
<aside class="sidebar">
<?php
$categories = get_terms( 'category', 'orderby=asc&hide_empty=0&parent=0&exclude=1' );
$current_category = get_queried_object();
?>
<nav class="filter-menu">
<h2>Categories</h2>
<ul>
<li><a href="/blog/archive/">All posts</a></li>
<?php foreach($categories as $category): ?>
<?php
$category_link = get_term_link( $category );
if($category->term_taxonomy_id == $current_category->term_id ) {
$current = "current";
} else {$current = '';}
?>
<li class="<?php echo $current; ?>"><a href="<?php echo $category_link; ?>"><?php echo $category->name; ?></a></li>
<?php endforeach; ?>
</ul>
</nav>
<!-- <nav class="">
<h2>Related Links</h2>
<ul>
<li><a href="#">Another place</a></li>
<li class="current"><a href="#">Law License Blog</a></li>
<li><a href="#">Within The Stacks</a></li>
</ul>
</nav> -->
</aside>
<article class="posts">
<?php while ( have_posts() ) : the_post(); ?>
<article class="post">
<header>
<h2><a href="<?php echo the_permalink(); ?>"><?php the_title(); ?></a></h2>
<?php if ( get_field('authorship') ) : ?>
<span class="byline">by
<?php
$authors = get_field('authorship');
if( $authors ):
$i = 1;
$count = count($authors);
foreach( $authors as $author ):
$permalink = get_permalink( $author->ID );
$title = get_the_title( $author->ID );
$custom_field = get_field( 'field_name', $author->ID );
if ($i < $count) {
$separator = ',';
}
else {
$separator = '';
}
?>
<a href="<?php echo esc_url( $permalink ); ?>"><?php echo esc_html( $title ); ?></a><?php echo $separator; ?>
<?php $i++; ?>
<?php endforeach; ?>
<?php endif; ?>
</span>
<?php endif; ?>
<span class="categories">
<?php the_category(', ') ?>
</span>
</header>
<figure>
<?php //echo get_the_post_thumbnail( $post_id, 'full' );
?>
<img src="<?php echo get_the_post_thumbnail_url( $post_id, 'large' ); ?>" alt="<?php echo get_post_meta ( get_post_thumbnail_id(), '_wp_attachment_image_alt', true ); ?>" />
<figcaption class="attribution"><?php echo get_the_post_thumbnail_caption( $post_id ); ?></figcaption>
</figure>
<?php the_excerpt(); ?>
</article>
<?php endwhile; // end of the loop. ?>
</article>
<nav class="pagination" aria-label="Pagination">
<?php
$big = 999999999; // need an unlikely integer
echo paginate_links( array(
'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
'format' => '?paged=%#%',
'mid_size' => 2,
'prev_text' => __( '<', 'textdomain' ),
'next_text' => __( '>', 'textdomain' ),
'current' => max( 1, get_query_var('paged') ),
'type' => 'list',
'total' => $wp_query->max_num_pages
) );
?>
</nav>
</main>
<?php get_footer(); ?>