Repository navigation
Expand file tree
/
Copy patharchive.php
More file actions
64 lines (57 loc) · 1.96 KB
/
Copy patharchive.php
File metadata and controls
64 lines (57 loc) · 1.96 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
<?php
/**
* archive.php — Post / taxonomy archive
*/
get_header();
$term = get_queried_object();
$is_term = $term instanceof WP_Term;
?>
<div class="bg-gray-50 border-b border-gray-100 py-10">
<div class="site-container">
<?php theme_breadcrumbs(); ?>
<div class="flex items-start justify-between gap-4 flex-wrap">
<div>
<?php if ( $is_term ) : ?>
<p class="eyebrow mb-2"><?php echo esc_html( $term->taxonomy === 'category' ? __('Category', 'theme') : $term->taxonomy ); ?></p>
<?php endif; ?>
<h1 class="display-md">
<?php
if ( is_day() ) echo get_the_date();
elseif ( is_month() ) echo get_the_date('F Y');
elseif ( is_year() ) echo get_the_date('Y');
elseif ( is_author() ) the_archive_title();
elseif ( $is_term ) echo esc_html($term->name);
else the_archive_title();
?>
</h1>
<?php if ( $is_term && $term->description ) : ?>
<p class="text-gray-500 mt-2 max-w-xl"><?php echo esc_html($term->description); ?></p>
<?php else : ?>
<?php the_archive_description('<p class="text-gray-500 mt-2 max-w-xl">', '</p>'); ?>
<?php endif; ?>
</div>
<p class="text-sm text-gray-400 mt-2">
<?php printf( _n('%s post', '%s posts', $wp_query->found_posts, 'theme'), number_format_i18n($wp_query->found_posts) ); ?>
</p>
</div>
</div>
</div>
<div class="site-container section">
<?php if ( have_posts() ) : ?>
<div class="grid-3">
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'template-parts/content/card', get_post_type() ); ?>
<?php endwhile; ?>
</div>
<div class="mt-10 flex justify-center">
<?php the_posts_pagination([
'prev_text' => '← ' . __('Older', 'theme'),
'next_text' => __('Newer', 'theme') . ' →',
'class' => 'pagination',
]); ?>
</div>
<?php else : ?>
<?php get_template_part('template-parts/content/none'); ?>
<?php endif; ?>
</div>
<?php get_footer();