質問編集履歴

1

全文のコードを記載しました

2021/05/02 23:08

投稿

Akira_papa
Akira_papa

スコア3

test CHANGED
File without changes
test CHANGED
@@ -28,8 +28,288 @@
28
28
 
29
29
 
30
30
 
31
+ ```
32
+
33
+ 以下該当部分です
34
+
35
+ <section class="section-contents" id="company">
36
+
37
+ <div class="wrapper">
38
+
39
+ <?php
40
+
41
+ $company_page = get_page_by_path('company');
42
+
43
+ $post = $company_page;
44
+
45
+ setup_postdata($post);
46
+
47
+ ;?>
48
+
49
+ <span class="section-title-en">test</span>
50
+
51
+ <h2 class="section-title"><?php the_title();?></h2>
52
+
53
+ <p class="section-lead">
54
+
55
+ <?php the_excerpt();?>
56
+
57
+ </p>
58
+
59
+ <div class="section-buttons">
60
+
61
+ <button type="button" class="button button-ghost" onclick="javascript:location.href = '<?php echo esc_url(home_url('company'));?>';">
62
+
63
+ <?php the_title();?>を見る
64
+
65
+ </button>
66
+
67
+ </div>
68
+
69
+ <?php wp_reset_postdata();?>
70
+
71
+ </div>
72
+
73
+ </section>
74
+
75
+ ```
76
+
77
+
78
+
79
+ 上記はfront-page.phpの一部です。全文は以下の通りです。
80
+
31
81
  ```ここに言語を入力
32
82
 
83
+ <?php get_header(); ?>
84
+
85
+ <section class="section-contents" id="shop">
86
+
87
+ <div class="wrapper">
88
+
89
+ <?php
90
+
91
+ $shop_obj = get_page_by_path('shop');
92
+
93
+ $post = $shop_obj;
94
+
95
+ setup_postdata($post);
96
+
97
+ $shop_title = get_the_title(); ?>
98
+
99
+ <span class="section-title-en">Shop Information</span>
100
+
101
+ <h2 class="section-title"><?php the_title(); ?></h2>
102
+
103
+ <p class="section-lead"><?php echo get_the_excerpt(); ?></p>
104
+
105
+ <?php wp_reset_postdata(); ?>
106
+
107
+ <ul class="shops">
108
+
109
+ <?php
110
+
111
+ $shop_pages = get_child_pages(4, $shop_obj->ID);
112
+
113
+ if ($shop_pages->have_posts()) :
114
+
115
+ while ($shop_pages->have_posts()) : $shop_pages->the_post();
116
+
117
+ ?>
118
+
119
+ <li class="shops-item">
120
+
121
+ <a class="shop-link" href="<?php the_permalink(); ?>">
122
+
123
+ <div class="shop-image">
124
+
125
+ <?php the_post_thumbnail('common'); ?>
126
+
127
+ </div>
128
+
129
+ <div class="shop-body">
130
+
131
+ <p class="name"><?php the_title(); ?></p>
132
+
133
+ <p class="location"></p>
134
+
135
+ <div class="buttonBox">
136
+
137
+ <button type="button" class="seeDetail">MORE</button>
138
+
139
+ </div>
140
+
141
+ </div>
142
+
143
+ </a>
144
+
145
+ </li>
146
+
147
+ <?php endwhile;
148
+
149
+ endif;
150
+
151
+ wp_reset_postdata(); ?>
152
+
153
+ </ul>
154
+
155
+ <div class="section-buttons">
156
+
157
+ <button type="button" class="button button-ghost" onclick="javascript:location.href = '<?php echo esc_url(home_url('shop')); ?>';">
158
+
159
+ <?php echo $shop_title; ?>一覧を見る
160
+
161
+ </button>
162
+
163
+ </div>
164
+
165
+ </div>
166
+
167
+ </section>
168
+
169
+ <section class="section-contents" id="contribution">
170
+
171
+ <div class="wrapper">
172
+
173
+ <?php
174
+
175
+ $contribution_obj = get_page_by_path('contribution');
176
+
177
+ $post = $contribution_obj;
178
+
179
+ setup_postdata($post);
180
+
181
+ $contribution_title = get_the_title(); ?>
182
+
183
+ <span class="section-title-en">Regional Contribution</span>
184
+
185
+ <h2 class="section-title"><?php the_title(); ?></h2>
186
+
187
+ <p class="section-lead"><?php echo get_the_excerpt(); ?></p>
188
+
189
+ <?php wp_reset_postdata(); ?>
190
+
191
+ <div class="articles">
192
+
193
+ <?php
194
+
195
+ $contribution_pages = get_child_pages(3, $contribution_obj->ID);
196
+
197
+ if ($contribution_pages->have_posts()) : while ($contribution_pages->have_posts()) : $contribution_pages->the_post();; ?>
198
+
199
+ <article class="article-card">
200
+
201
+ <a class="card-link" href="<?php the_permalink(); ?>">
202
+
203
+ <div class="card-inner">
204
+
205
+ <div class="card-image">
206
+
207
+ <?php the_post_thumbnail('front-contribution'); ?>
208
+
209
+ </div>
210
+
211
+ <div class="card-body">
212
+
213
+ <p class="title"><?php the_title(); ?></p>
214
+
215
+ <p class="excerpt"><?php echo get_the_excerpt(); ?></p>
216
+
217
+ <div class="buttonBox">
218
+
219
+ <button type="button" class="seeDetail">MORE</button>
220
+
221
+ </div>
222
+
223
+ </div>
224
+
225
+ </div>
226
+
227
+ </a>
228
+
229
+ </article>
230
+
231
+ <?php endwhile;
232
+
233
+ endif;
234
+
235
+ wp_reset_postdata();?>
236
+
237
+ </div>
238
+
239
+ <div class="section-buttons">
240
+
241
+ <button type="button" class="button button-ghost" onclick="javascript:location.href = '<?php echo esc_url(home_url('contribution')); ?>';">
242
+
243
+ <?php echo $contribution_title;?>一覧を見る
244
+
245
+ </button>
246
+
247
+ </div>
248
+
249
+ </div>
250
+
251
+ </section>
252
+
253
+ <section class="section-contents" id="news">
254
+
255
+ <div class="wrapper">
256
+
257
+ <?php
258
+
259
+ $term_obj = get_term_by('slug', 'news', 'category'); ?>
260
+
261
+ <span class="section-title-en">News Release</span>
262
+
263
+ <h2 class="section-title"><?php echo $term_obj->name; ?></h2>
264
+
265
+ <p class="section-lead"><?php echo $term_obj->description; ?></p>
266
+
267
+ <ul class="news">
268
+
269
+ <?php
270
+
271
+ $news_posts = get_specific_posts('post', 'category', 'news', 3);
272
+
273
+ // var_dump($news_posts);
274
+
275
+ if ($news_posts->have_posts()) : while ($news_posts->have_posts()) : $news_posts->the_post(); ?>
276
+
277
+ <li class="news-item">
278
+
279
+ <a class="detail-link" href="<?php the_permalink(); ?>">
280
+
281
+ <time class="time"><?php the_time('Y.m.d'); ?></time>
282
+
283
+ <p class="title"><?php the_title(); ?></p>
284
+
285
+ <p class="news-text"><?php the_excerpt(); ?></p>
286
+
287
+ </a>
288
+
289
+ </li>
290
+
291
+ <?php endwhile;
292
+
293
+ endif;
294
+
295
+ wp_reset_postdata(); ?>
296
+
297
+ </ul>
298
+
299
+ <div class="section-buttons">
300
+
301
+ <button type="button" class="button button-ghost" onclick="javascript:location.href = '<?php echo esc_url(get_term_link($term_obj)); ?>';">
302
+
303
+ <?php echo $term_obj->name; ?>一覧を見る
304
+
305
+ </button>
306
+
307
+ </div>
308
+
309
+ </div>
310
+
311
+ </section>
312
+
33
313
  <section class="section-contents" id="company">
34
314
 
35
315
  <div class="wrapper">
@@ -70,4 +350,6 @@
70
350
 
71
351
  </section>
72
352
 
353
+ <?php get_footer(); ?>
354
+
73
355
  ```