-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsearch.php
More file actions
128 lines (108 loc) · 5.8 KB
/
Copy pathsearch.php
File metadata and controls
128 lines (108 loc) · 5.8 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
<?php
/**
* 検索結果ページテンプレート
*
* @package Backbone_SEO_LLMO
*/
get_header(); ?>
<?php if (have_posts()) : ?>
<header class="page-header">
<h1 class="page-title">
<?php
printf(
__('検索結果: %s', 'backbone-seo-llmo'),
'<span>' . get_search_query() . '</span>'
);
?>
</h1>
<p class="search-results-count">
<?php
global $wp_query;
printf(
__('%d件の結果が見つかりました', 'backbone-seo-llmo'),
$wp_query->found_posts
);
?>
</p>
</header>
<?php
// グリッド列数を取得
$grid_columns = backbone_get_archive_setting('grid_columns', '3');
// 表示要素の設定
$show_thumbnail = backbone_get_archive_setting('show_thumbnail', true);
$thumbnail_size = backbone_get_archive_setting('thumbnail_size', 'full');
$show_date = backbone_get_archive_setting('show_date', true);
$show_modified = backbone_get_archive_setting('show_modified', false);
$show_category = backbone_get_archive_setting('show_category', false);
$show_excerpt = backbone_get_archive_setting('show_excerpt', true);
?>
<div class="archive-grid-container archive-grid-columns-<?php echo esc_attr($grid_columns); ?>">
<?php while (have_posts()) : ?>
<?php the_post(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header">
<?php the_title('<h2 class="entry-title"><a href="' . esc_url(get_permalink()) . '" rel="bookmark">', '</a></h2>'); ?>
<?php if ($show_date || $show_modified || $show_category) : ?>
<div class="entry-meta">
<?php if ($show_date) : ?>
<time datetime="<?php echo get_the_date('c'); ?>" class="meta-badge date-badge">
<span class="meta-label-small"><?php echo __('投稿', 'backbone-seo-llmo'); ?>:</span><?php echo get_the_date('Y/m/d'); ?>
</time>
<?php endif; ?>
<?php if ($show_modified) : ?>
<time datetime="<?php echo get_the_modified_date('c'); ?>" class="meta-badge modified-badge">
<span class="meta-label-small"><?php echo __('更新', 'backbone-seo-llmo'); ?>:</span><?php echo get_the_modified_date('Y/m/d'); ?>
</time>
<?php endif; ?>
<?php if ($show_category && get_post_type() === 'post') : ?>
<?php
$categories = get_the_category();
if ($categories) {
echo '<span class="post-category meta-badge">' . esc_html($categories[0]->name) . '</span>';
}
?>
<?php endif; ?>
</div>
<?php endif; ?>
</header>
<?php if ($show_thumbnail && has_post_thumbnail()) : ?>
<div class="post-thumbnail">
<a href="<?php the_permalink(); ?>">
<?php the_post_thumbnail($thumbnail_size); ?>
</a>
</div>
<?php endif; ?>
<?php if ($show_excerpt) : ?>
<div class="entry-content">
<?php the_excerpt(); ?>
</div>
<?php endif; ?>
</article>
<?php endwhile; ?>
</div><!-- .archive-grid-container -->
<?php
// ページネーション
backbone_pagination();
?>
<?php else : ?>
<section class="no-results not-found">
<header class="page-header">
<h1 class="page-title"><?php _e('見つかりません', 'backbone-seo-llmo'); ?></h1>
</header>
<div class="page-content">
<p><?php _e('お探しのキーワードに一致するものが見つかりませんでした。別のキーワードで検索してみてください。', 'backbone-seo-llmo'); ?></p>
<div class="search-form-wrapper">
<?php get_search_form(); ?>
</div>
<div class="search-suggestions">
<h3><?php _e('検索のヒント', 'backbone-seo-llmo'); ?></h3>
<ul>
<li><?php _e('キーワードのスペルを確認してください', 'backbone-seo-llmo'); ?></li>
<li><?php _e('より一般的なキーワードで検索してください', 'backbone-seo-llmo'); ?></li>
<li><?php _e('同義語や関連語を試してください', 'backbone-seo-llmo'); ?></li>
</ul>
</div>
</div>
</section>
<?php endif; ?>
<?php get_footer(); ?>