-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy patharchives.php
66 lines (61 loc) · 1.47 KB
/
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
60
61
62
63
64
65
66
<?php
/*
Template Name: Archives
*/
get_header();
?>
<main id="main-content" role="main">
<div class="container">
<div class="row">
<div class="col-12 text-center">
<h1><?php echo get_the_title(); ?></h1>
</div>
</div>
<div class="row">
<aside class="col-12 order-last order-lg-first archive">
<h2>Filter news by year</h2>
<?php
wp_custom_archive();
?>
</aside>
<div class="col-12 offset-0 col-lg-6">
<?php
if (have_posts()) :
while (have_posts()) :
the_post();
the_content();
endwhile;
endif;
?>
<?php
$options = [
'post_status' => 'publish',
'orderby' => 'date',
'order' => 'DESC',
'numberposts' => 15,
];
$posts = get_posts($options);
?>
<ul class="list-unstyled">
<?php
foreach($posts as $post){
$restricted = get_field('authenticated_users_only', $post);
if($restricted && !is_user_logged_in()){
continue;
}
?><li><?php
$date = new DateTime($post->post_date);
echo '<a href="'.get_permalink($post).'">';
echo $date->format('Y-m-d').' '.$post->post_title;
echo '</a>';
echo '<hr>';
?></li><?php
}
?>
</ul>
</div>
</div>
</div>
</main>
<?php
get_footer();