-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharchive.php
More file actions
148 lines (137 loc) · 5.41 KB
/
Copy patharchive.php
File metadata and controls
148 lines (137 loc) · 5.41 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<?php
/**
* The template for displaying archive pages
*
* Used to display archive-type pages if nothing more specific matches a query.
* For example, puts together date-based pages if no date.php file exists.
*
* If you'd like to further customize these archive views, you may create a
* new template file for each one. For example, tag.php (Tag archives),
* category.php (Category archives), author.php (Author archives), etc.
*
* @link https://codex.wordpress.org/Template_Hierarchy
*
* @package Cielos
* @since Cielos 1.0.0
*/
get_header(); ?>
<div class="container mx-auto px-4 py-8">
<div class="grid grid-cols-1 lg:grid-cols-3 gap-8 mt-5">
<main id="main" class="lg:col-span-2" role="main" tabindex="-1">
<?php if (have_posts()) : ?>
<header class="page-header mb-8 pb-6">
<?php
if (is_category() && function_exists('z_taxonomy_image_url')) {
$category = get_queried_object();
$image_url = z_taxonomy_image_url($category->term_id);
if ($image_url) {
echo '<img src="' . esc_url($image_url) . '" alt="' . esc_attr($category->name) . '" class="w-full h-auto object-cover rounded-lg mb-6 shadow-md" loading="lazy" decoding="async">';
}
}
?>
<div class="space-y-3">
<div class="flex items-center gap-2 text-sm text-[var(--c-muted)]">
<i class="i-carbon-folder text-[var(--c-primary)]"></i>
<span class="font-medium">
<?php
if (is_category()) {
echo 'カテゴリー';
} elseif (is_tag()) {
echo 'タグ';
} elseif (is_day()) {
echo '日別アーカイブ';
} elseif (is_month()) {
echo '月別アーカイブ';
} elseif (is_year()) {
echo '年別アーカイブ';
} elseif (is_tax()) {
echo 'カスタム分類';
} elseif (is_search()) {
echo '検索結果';
} elseif (is_author()) {
echo '著者アーカイブ';
} else {
echo 'ブログアーカイブ';
}
?>
</span>
</div>
<h1 class="page-title heading04-3 leading-[1.2] break-words" style="font-size: var(--latest-title-fs); color: var(--latest-fg); background-image: var(--latest-bg-stack); border-color: var(--latest-border); box-shadow: var(--latest-inset), var(--shadow-1); padding-top: 1.25rem; padding-bottom: 1.25rem;">
<i class="i-carbon-folder text-lg mr-3 ml-3" aria-hidden="true" style="vertical-align: middle;"></i><?php
if (is_category()) {
single_cat_title();
} elseif (is_tag()) {
single_tag_title();
} elseif (is_day()) {
echo get_the_date('Y年n月j日');
} elseif (is_month()) {
echo get_the_date('Y年n月');
} elseif (is_year()) {
echo get_the_date('Y年');
} elseif (is_tax()) {
single_term_title();
} elseif (is_search()) {
echo '「' . get_search_query() . '」';
} elseif (is_author()) {
echo esc_html(get_the_author_meta('display_name', get_query_var('author')));
} else {
echo 'ブログ';
}
?></h1>
<?php if (is_category() || is_tag() || is_tax()) : ?>
<?php $description = term_description(); ?>
<?php if (!empty($description)) : ?>
<div class="text-[var(--c-muted)] text-sm sm:text-base leading-relaxed mt-4">
<?php echo $description; ?>
</div>
<?php endif; ?>
<?php endif; ?>
</div>
</header>
<?php
// 現在のカテゴリ/タグ/タームのIDを取得
$term_id = '';
$term_type = '';
if (is_category()) {
$term_id = get_queried_object_id();
$term_type = 'category';
} elseif (is_tag()) {
$term_id = get_queried_object_id();
$term_type = 'tag';
} elseif (is_tax()) {
$term_id = get_queried_object_id();
$term_type = get_queried_object()->taxonomy;
}
?>
<div id="post-list-app" data-show-title="false" data-layout="list" data-term-id="<?php echo esc_attr($term_id); ?>" data-term-type="<?php echo esc_attr($term_type); ?>"></div>
<?php
// Pagination handled by Vue component
global $wp_query;
$current_page = max(1, get_query_var('paged'));
$total_pages = $wp_query->max_num_pages;
if ($total_pages > 1) :
// Get base URL for pagination
$base_url = get_pagenum_link(1);
if (strpos($base_url, '?') !== false) {
$base_url = preg_replace('/\?.*/', '', $base_url);
}
$base_url = trailingslashit($base_url) . 'page/%#%/';
?>
<script>
window.unomoonPagination = {
currentPage: <?php echo esc_js($current_page); ?>,
totalPages: <?php echo esc_js($total_pages); ?>,
base: <?php echo wp_json_encode($base_url); ?>
};
</script>
<div id="pagination-app"></div>
<?php endif; ?>
<?php else : ?>
<?php get_template_part('template-parts/content', 'none'); ?>
<?php endif; ?>
</main>
<?php get_sidebar(); ?>
</div>
</div>
<?php
get_footer();