-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
40 lines (28 loc) · 1.07 KB
/
index.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
<?php get_header(); ?>
<div class="main-content">
<?php get_template_part('inc/subheader'); ?>
<?php if ( get_theme_mod('heading-enable','off') == 'on' ) : ?>
<?php get_template_part('inc/page-title'); ?>
<?php endif; ?>
<?php if ( have_posts() ) : ?>
<div class="stickywrap">
<?php while ( have_posts() ): the_post(); ?>
<?php
// Assign the year to a variable
$year = get_the_date('Y', '', '', FALSE);
$year_link = get_year_link($year);
// If your year hasn't been echoed earlier in the loop, echo it now
if (! isset($year_check) || $year !== $year_check) {
echo "</div><div class='stickywrap'><h3 class='sticky-heading'><a href='" . $year_link . "'>" . $year . "</a></h3>";
}
// Now that your year has been printed, assign it to the $year_check variable
$year_check = $year;
?>
<?php get_template_part('content'); ?>
<?php endwhile; ?>
</div>
<?php get_template_part('inc/pagination'); ?>
<?php endif; ?>
</div><!--/.main-content-->
<?php get_sidebar(); ?>
<?php get_footer(); ?>