forked from DannyCooper/arke
-
Notifications
You must be signed in to change notification settings - Fork 0
/
archive-template.php
58 lines (43 loc) · 1.22 KB
/
archive-template.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
<?php
/**
* Template Name: Archive Template
*
* @package Arke
* @copyright Copyright (c) 2018, Danny Cooper
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
*/
get_template_part( 'header' );
?>
<header>
<h1 class="archives__heading"><?php single_post_title(); ?></h1>
</header>
<?php
$args = array(
'post_type' => 'post',
'post_status' => 'publish',
'posts_per_page' => -1,
);
$posts = new WP_Query( $args );
if ( $posts->have_posts() ) :
echo '<ul class="archives__list">';
while ( $posts->have_posts() ) :
$posts->the_post();
echo '<li><a href="' . esc_url( get_the_permalink() ) . '">' . get_the_title() . '</a><span>' . esc_attr( get_the_time( 'F j, Y' ) ) . '</span></li>';
endwhile;
echo '</ul>';
wp_reset_postdata();
else :
echo '<p>' . esc_html__( 'Sorry, no posts matched your criteria.', 'arke' ) . '</p>';
endif;
?>
</div><!-- .content-area -->
</div><!-- .site-content -->
<footer class="site-footer">
<?php
// translators: %1$s: theme name.
// translators: %2$s: theme author.
?>
</footer><!-- .site-footer -->
<?php wp_footer(); ?>
</body>
</html>