-
Notifications
You must be signed in to change notification settings - Fork 8
/
search.php
228 lines (218 loc) · 8.43 KB
/
search.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
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
<!doctype html>
<html amp <?php language_attributes(); ?>>
<head>
<?php get_header() ?>
<style amp-custom>
<?php load_css("css/global") ?>
<?php load_css("css/head",'common') ?>
<?php load_css("css/head",'menu') ?>
<?php load_css("css/main",'body') ?>
<?php load_css("css/main", 'sidebar') ?>
<?php load_css("css/footer", 'common') ?>
.main-container {
width: 59.5238vw;
}
.title-img {
width: 59.5238vw;
height: 22.0238vw;
}
.post-info {
width: 59.5238vw;
}
/* search box */
.search-box {
display: flex;
width: 100%;
align-items: center;
justify-content: center;
flex-direction: column;
position: absolute;
top: 5.1563vw;
}
.search-box h2 {
font-size: 2.0238vw;
line-height: 2.0238vw;
color: white;
margin-top: 0;
margin-bottom: 1.8452vw;
}
.search-form {
position: relative;
display: flex;
align-items: center;
opacity: 0.9;
}
.widget_search {
border-bottom: none;
padding-bottom: 0;
}
.search-form input[type='text'] {
width: 59.5238vw;
height: 3.5714vw;
border: 0.0595vw #4A4A4A solid;
border-radius: 0.3571vw;
padding-left: 1.8452vw;
padding-right: 3.5714vw;
font-size: 1.1905vw;
line-height: 1.1905vw;
box-sizing: border-box;
background: #2A2A2A;
color: white;
}
.search-form input[type='text']::placeholder {
font-size: 1.1905vw;
line-height: 1.1905vw;
color: #8A8A8A;
}
.search-form button[type='submit'] {
position: absolute;
right: 0;
padding: 0;
border: none;
background: unset;
}
.search-form button[type='submit']:before {
content: '\e62c';
font-family: "iconfont";
color: #B0B0B0;
font-size: 1.7857vw;
margin-right: 1.7857vw;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
cursor: pointer;
}
.nothing h3 {
margin-top: 0;
}
.nothing{
margin-bottom: 29.7619vw;
}
main {
justify-content: center;
}
/* mobile */
@media only screen and (max-width: 640px){
.main-container {
width: 92vw;
}
.title-img {
width: 92vw;
height: 34.1333vw;
}
.post-info {
width: 92vw;
}
.search-box {
margin-top: 5.4667vw;
margin-bottom: 5.3333vw
}
.search-box h2 {
font-size: 3.7333vw;
line-height: 3.7333vw;
margin-bottom: 4.44vw;
}
.search-form input[type='text'] {
width: 89.3333vw;
height: 8vw;
border: 0.1333vw #4A4A4A solid;
border-radius: 0.8vw;
padding-left: 4vw;
padding-right: 6.6667vw;
font-size: 3.7333vw;
line-height: 3.7333vw;
}
.search-form input[type='text']::placeholder {
font-size: 3.7333vw;
line-height: 3.7333vw;
}
.search-form button[type='submit']:before {
font-size: 4vw;
margin-right: 2.6667vw;
}
}
</style>
</head>
<body>
<?php
echo get_theme_mod('body_js', '');
?>
<?php if (has_nav_menu('primary')):?>
<input type="checkbox" id="header-menu-button"/>
<?php endif; ?>
<header id="commonTop"
<?php if ( get_header_image() ) : ?>
style="background: url('<?php header_image(); ?>') 100% / cover no-repeat;"
<?php endif; ?>>
<div class="top-container">
<?php get_template_part('components/title-menus'); ?>
<div class="search-box">
<h2><?php echo sprintf( __( 'Search Results %1$s %2$s' ), '', '') ?></h2>
<form target="_top" role="search" method="get" class="search-form" action="<?php echo follow_scheme_replace(get_site_url()) ?>">
<input type="text" required class="search-field" placeholder="<?php echo esc_attr_x( 'Search …', 'placeholder','default' )?>" value="<?php echo get_search_query()?>" name="s" />
<button type="submit" class="search-submit"></button>
</form>
</div>
</div>
</header>
<main>
<div class="main-container">
<div class="post-list">
<?php if (!have_posts()): ?>
<div class="nothing">
<h3><?php _e( 'No results found.','default'); ?></h3>
</div>
<?php endif; ?>
<?php while (have_posts()) : the_post(); ?>
<article class="list-box">
<?php if ($thumb = my_post_thumbnail()): ?>
<a href="<?php the_permalink() ?>" class="title-img">
<amp-img class="contain"
src="<?php echo $thumb?>"
layout="fill"
>
</amp-img>
</a>
<?php endif; ?>
<div class="post-info">
<?php get_template_part('components/meta-category'); ?>
<h2 class="post-title">
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
</h2>
<div class="post-excerpt">
<?php echo get_the_excerpt() ?>
</div>
<div class="flex-box justify-between">
<a href="<?php the_permalink(); ?>" class="read-more"><?php _e('Read more','default'); ?><span class="iconfont icon-ml-readmore"></span></a>
<div class="flex-box post-meta-box">
<?php if ($edit_link = get_edit_post_link(get_the_ID())): ?>
<div class="flex-box">
<a class="post-meta edit-link" href="<?php echo esc_url($edit_link);?>"><span class="iconfont icon-mr-postmeta"></span><?php _e('Edit','default')?></a>
</div>
<?php endif; ?>
<a class="post-meta" href="<?php the_permalink() ?>#comments"><span class="iconfont icon-mr-postmeta"></span><?php comments_number('0', '1', '%'); ?></a>
<a class="post-meta" href="<?php the_permalink() ?>"><span class="iconfont icon-mr-postmeta"></span><?php echo (int)get_post_meta(get_the_ID(), 'views', true); ?></a>
<a class="post-meta" href="<?php the_permalink() ?>"><span class="iconfont icon-mr-postmeta icon-like-sp"></span><?php echo (int)get_post_meta(get_the_ID(),'likes',true); ?></a>
</div>
</div>
<div class="flex-box post-publish-date">
<div class="post-date">
<?php echo get_the_date('d') ?>
</div>
<div class="post-month">
<?php echo get_the_date('M') ?>
</div>
</div>
</div>
</article>
<?php endwhile; ?>
</div>
<?php echo get_the_posts_pagination( array(
'mid_size' => 3,
'prev_next' => false,
) ); ?>
</div>
<?php if (have_posts()) get_template_part('components/scrolltop'); ?>
</main>
<?php get_template_part('components/footer'); ?>
</body>
</html>