-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharchive.php
More file actions
109 lines (93 loc) · 3.08 KB
/
archive.php
File metadata and controls
109 lines (93 loc) · 3.08 KB
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
<?php
/**
* Archive Template
*
* Uses archive controller pages when available, otherwise displays default layout.
* Create pages with specific slugs to control archive layouts:
* - archive-category → Category archives
* - archive-tag → Tag archives
* - archive-author → Author archives
* - archive-date → Date archives
* - archive-blog → Blog/post archives
*
* @package Pioneer
*/
get_header();
?>
<main id="main" class="site-main" role="main">
<?php do_action( 'pioneer_main_start' ); ?>
<?php
// Try to use archive controller page - if not available, show fallback.
// Check if module exists first (deletability: theme works without archive-controller module).
$archive_rendered = function_exists( 'pioneer_render_archive_controller' )
&& pioneer_render_archive_controller();
if ( ! $archive_rendered ) :
// Fallback: Default archive layout.
$context = function_exists( 'pioneer_get_archive_context' )
? pioneer_get_archive_context()
: array(
'title' => get_the_archive_title(),
'description' => get_the_archive_description(),
);
?>
<div class="container">
<?php do_action( 'pioneer_before_content' ); ?>
<header class="archive-header">
<?php if ( ! empty( $context['title'] ) ) : ?>
<h1 class="archive-title"><?php echo esc_html( $context['title'] ); ?></h1>
<?php endif; ?>
<?php if ( ! empty( $context['description'] ) ) : ?>
<div class="archive-description">
<?php echo wp_kses_post( $context['description'] ); ?>
</div>
<?php endif; ?>
</header>
<?php if ( have_posts() ) : ?>
<div class="posts-grid posts-grid--columns-3">
<?php
while ( have_posts() ) :
the_post();
?>
<?php do_action( 'pioneer_post_before', get_post() ); ?>
<article <?php post_class( 'posts-grid__item' ); ?>>
<?php if ( has_post_thumbnail() ) : ?>
<div class="posts-grid__image">
<a href="<?php the_permalink(); ?>">
<?php the_post_thumbnail( 'medium_large' ); ?>
</a>
</div>
<?php endif; ?>
<div class="posts-grid__content">
<h2 class="posts-grid__title">
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
</h2>
<div class="posts-grid__meta">
<time datetime="<?php echo esc_attr( get_the_date( 'c' ) ); ?>">
<?php echo esc_html( get_the_date() ); ?>
</time>
</div>
<div class="posts-grid__excerpt">
<?php the_excerpt(); ?>
</div>
</div>
</article>
<?php do_action( 'pioneer_post_after', get_post() ); ?>
<?php endwhile; ?>
</div>
<?php
the_posts_pagination(
array(
'prev_text' => __( '← Previous', 'pioneer' ),
'next_text' => __( 'Next →', 'pioneer' ),
)
);
?>
<?php else : ?>
<p><?php esc_html_e( 'No posts found.', 'pioneer' ); ?></p>
<?php endif; ?>
<?php do_action( 'pioneer_after_content' ); ?>
</div>
<?php endif; // End fallback layout. ?>
<?php do_action( 'pioneer_main_end' ); ?>
</main>
<?php get_footer(); ?>