-
Notifications
You must be signed in to change notification settings - Fork 217
/
date.php
96 lines (82 loc) · 2.12 KB
/
date.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
<?php
/**
* Date Archive Page template file.
*
* @package Aquila
*/
get_header();
global $wp_query;
$the_date = '';
$the_date_permalink = get_home_url();
// Is Year Archive '/{year}/'
if ( is_year() ) {
$the_date = get_the_date( 'Y' );
$the_date_permalink = sprintf(
'%1$s%2$s/',
trailingslashit( $the_date_permalink ),
get_query_var( 'year' )
);
}
// Is Monthly Archive '/{year}/{month}/'
if ( is_month() ) {
$the_date = get_the_date( 'F, Y' );
$the_date_permalink = sprintf(
'%1$s%2$s/%3$s/',
trailingslashit( $the_date_permalink ),
get_query_var( 'year' ),
get_query_var( 'monthnum' )
);
}
// Is Daily Archive '/{year}/{month}/{day}/'
if ( is_day() ) {
$the_date = get_the_date( 'F j, Y' );
$the_date_permalink = sprintf(
'%1$s%2$s/%3$s/%4$s/',
trailingslashit( $the_date_permalink ),
get_query_var( 'year' ),
get_query_var( 'monthnum' ),
get_query_var( 'day' )
);
}
$current_page_no = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;
$first_page_url = $the_date_permalink;
$last_page_url = sprintf(
'%1$spage/%2$s',
esc_url( $the_date_permalink ),
esc_attr( $wp_query->max_num_pages )
);
?>
<div id="primary">
<main id="main" class="site-main my-5" role="main">
<div class="container">
<header class="page-header">
<?php
if ( ! empty( $the_date ) ) {
printf(
'<h1 class="page-title h1 inline-block mb-4">%s</h1>',
$the_date
);
}
?>
</header><!-- .page-header -->
<div class="site-content">
<div class="row">
<?php
if ( $wp_query->have_posts() ) :
while ( $wp_query->have_posts() ) : $wp_query->the_post();
get_template_part( 'template-parts/content', '', [ 'container_classes' => 'col-lg-4 col-md-6 col-sm-12 pb-4' ] );
endwhile;
else :
get_template_part( 'template-parts/content-none' );
endif;
?>
</div>
<div>
<?php aquila_the_post_pagination( $current_page_no, AQUILA_ARCHIVE_POST_PER_PAGE, $wp_query, $first_page_url, $last_page_url, false ); ?>
</div>
</div>
</div>
</main>
</div>
<?php
get_footer();