質問編集履歴

2

具体的なコードを追記

2017/02/15 04:10

投稿

ho-ri
ho-ri

スコア11

test CHANGED
File without changes
test CHANGED
@@ -455,3 +455,15 @@
455
455
 
456
456
 
457
457
  ※ 投稿には設置されており、single.phpでは出力していないカスタムフィールドを、印刷用では利用していますのでご了承ください。
458
+
459
+
460
+
461
+
462
+
463
+
464
+
465
+ 上記のような形で既存のsingle.phpで出力される情報とは別に、同様のpostのデータを用いて別ページを出力する方法はございますでしょうか。
466
+
467
+
468
+
469
+ よろしくお願いいたします。

1

具体的なコードを追記

2017/02/15 04:10

投稿

ho-ri
ho-ri

スコア11

test CHANGED
File without changes
test CHANGED
@@ -21,3 +21,437 @@
21
21
 
22
22
 
23
23
  Wordpressの基礎部分しか理解していないため、手段をご教示いただければと思います。
24
+
25
+
26
+
27
+
28
+
29
+
30
+
31
+ 追記
32
+
33
+
34
+
35
+ 具体的には
36
+
37
+
38
+
39
+
40
+
41
+ 現在
42
+
43
+
44
+
45
+ single.phpにて、
46
+
47
+
48
+
49
+ ```ここに言語を入力
50
+
51
+
52
+
53
+ <?php if(have_posts()): while(have_posts()): the_post(); ?>
54
+
55
+
56
+
57
+ <!-- 物件情報1 -->
58
+
59
+ <div class="detail01 btm030">
60
+
61
+ <h4><img src="<?php echo get_template_directory_uri(); ?>/images/arrowico-mid02.png" />物件空室 / 募集状況</h4>
62
+
63
+
64
+
65
+ <table class="detail_table03">
66
+
67
+ <tr>
68
+
69
+ <th>階数</th>
70
+
71
+ <th>坪数</th>
72
+
73
+ <th>賃料/円 (税別)</th>
74
+
75
+ <th>共益費(税別)</th>
76
+
77
+ <th>敷金</th>
78
+
79
+ <th>礼金</th>
80
+
81
+ <th>入居可能日</th>
82
+
83
+ <th>間取図</th>
84
+
85
+ </tr>
86
+
87
+
88
+
89
+ <?php if(post_custom('rent') == '空き'): ?>
90
+
91
+ <tr>
92
+
93
+ <td><?php the_field("kai", $post->ID); ?></td>
94
+
95
+ <td><?php the_field("tubo", $post->ID); ?>坪</td>
96
+
97
+ <?php if(post_custom('yachin')): ?>
98
+
99
+ <td><?php echo number_format(get_post_meta($post->ID,'yachin',true));?>円</td>
100
+
101
+ <?php else : ?><td><span>応相談</span></td>
102
+
103
+ <?php endif; ?>
104
+
105
+ <?php if(post_custom('kyoeki')): ?>
106
+
107
+ <td><?php echo number_format(get_post_meta($post->ID,'kyoeki',true));?>円</td>
108
+
109
+ <?php else : ?><td>-</td>
110
+
111
+ <?php endif; ?>
112
+
113
+ <?php if(post_custom('sikien')): ?>
114
+
115
+ <td><?php the_field("sikien", $post->ID); ?>
116
+
117
+ <?php
118
+
119
+ $array = array(
120
+
121
+ "0" => "-"
122
+
123
+ );
124
+
125
+ ?>
126
+
127
+ </td>
128
+
129
+ <?php else : ?><td>応相談</td>
130
+
131
+ <?php endif; ?>
132
+
133
+ <?php if(post_custom('reien')): ?>
134
+
135
+ <td><?php the_field("reien", $post->ID); ?></td>
136
+
137
+ <?php else : ?><td>応相談</td>
138
+
139
+ <?php endif; ?>
140
+
141
+ <?php if(post_custom('checkin')): ?>
142
+
143
+ <td><?php the_field("checkin", $post->ID); ?></td>
144
+
145
+ <?php else : ?><td>応相談</td>
146
+
147
+ <?php endif; ?>
148
+
149
+ <?php if(post_custom('space')): ?>
150
+
151
+ <td><a href="javascript:w=window.open('<?php the_field("space", $post->ID); ?>','','scrollbars=yes,Width=470,Height=350');w.focus();">間取図</a></td>
152
+
153
+ <?php else : ?><td>-</td>
154
+
155
+ <?php endif; ?>
156
+
157
+ </tr>
158
+
159
+ <?php endif; ?>
160
+
161
+ </table>
162
+
163
+ <div><!-- datail01 -->
164
+
165
+ <!-- //物件情報1 -->
166
+
167
+
168
+
169
+ <!-- 物件情報2 -->
170
+
171
+ <div class="detail02 btm050">
172
+
173
+ <table class="detail_table01">
174
+
175
+ <tr>
176
+
177
+ <th>住所</th>
178
+
179
+ <td><?php the_field("address", $post->ID); ?></td>
180
+
181
+ </tr>
182
+
183
+ <tr>
184
+
185
+ <th>最寄駅</th>
186
+
187
+ <td>【<?php the_field("station", $post->ID); ?>駅】 約<?php the_field("walk", $post->ID); ?>分
188
+
189
+ <?php if(post_custom('station2')): ?>
190
+
191
+ 【<?php the_field("station2", $post->ID); ?>駅】 約<?php the_field("walk2", $post->ID); ?>分</td>
192
+
193
+ </tr>
194
+
195
+ <?php endif; ?>
196
+
197
+ <?php if(post_custom('year')): ?>
198
+
199
+ <tr>
200
+
201
+ <th>竣工年月</th>
202
+
203
+ <td><?php the_field("year", $post->ID); ?></td>
204
+
205
+ </tr>
206
+
207
+ <?php endif; ?>
208
+
209
+ <?php if(post_custom('upkai')): ?>
210
+
211
+ <tr>
212
+
213
+ <th>地上階/地下階</th>
214
+
215
+ <td><?php the_field("upkai", $post->ID); ?></td>
216
+
217
+ </tr>
218
+
219
+ <?php endif; ?>
220
+
221
+ <?php if(post_custom('kozo')): ?>
222
+
223
+ <tr>
224
+
225
+ <th>構造</th>
226
+
227
+ <td><?php the_field("kozo", $post->ID); ?></td>
228
+
229
+ </tr>
230
+
231
+ <?php endif; ?>
232
+
233
+ <?php if(post_custom('text')): ?>
234
+
235
+ <tr>
236
+
237
+ <th><?php the_title(); ?>の特長</th>
238
+
239
+ <td><?php the_field("text", $post->ID); ?></td>
240
+
241
+ </tr>
242
+
243
+ <?php endif; ?>
244
+
245
+ </table>
246
+
247
+
248
+
249
+ </div><!-- datail02 -->
250
+
251
+ <!-- //物件情報2 -->
252
+
253
+
254
+
255
+ <?php endwhile; else: ?>
256
+
257
+ <p><?php echo "お探しの記事、ページは見つかりませんでした。"; ?></p>
258
+
259
+ <?php endif; ?>
260
+
261
+
262
+
263
+ ```
264
+
265
+
266
+
267
+ 上記のような形で、カスタムフィールドで投稿した物件情報を出力しております。
268
+
269
+
270
+
271
+ ---
272
+
273
+
274
+
275
+ 上記と同じpostの情報を用いて印刷出力用に別のページを出力したいと思っております。
276
+
277
+
278
+
279
+
280
+
281
+ ```ここに言語を入力
282
+
283
+
284
+
285
+ <?php if(have_posts()): while(have_posts()): the_post(); ?>
286
+
287
+
288
+
289
+ <section class="title">
290
+
291
+ <p class="title_name"><?php the_title(); ?></p>
292
+
293
+ </section>
294
+
295
+
296
+
297
+ <section class="outline clearfix">
298
+
299
+ <h2>物件概要</h2>
300
+
301
+ <dl class="add"><dt>所在地</dt><dd><?php if(post_custom('address')): ?><?php the_field("address", $post->ID); ?><?php endif; ?></dd></dl>
302
+
303
+ <dl><dt>竣工</dt><dd><?php if(post_custom('year')): ?><?php the_field("year", $post->ID); ?><?php endif; ?></dd></dl>
304
+
305
+ <dl><dt>構造</dt><dd><?php if(post_custom('kozo')): ?><?php the_field("kozo", $post->ID); ?><?php endif; ?></dd></dl>
306
+
307
+ <dl><dt>規模</dt><dd><?php if(post_custom('upkai')): ?><?php the_field("upkai", $post->ID); ?><?php endif; ?></dd></dl>
308
+
309
+ <dl><dt>時間制限</dt><dd><?php if(post_custom('time')): ?><?php the_field("time", $post->ID); ?><?php endif; ?></dd></dl>
310
+
311
+ <dl><dt>トイレ</dt><dd>トイレの出力</dd></dl>
312
+
313
+ <dl><dt>空調</dt><dd><?php if(post_custom('air')): ?><?php the_field("air", $post->ID); ?><?php endif; ?></dd></dl>
314
+
315
+ <dl><dt>床</dt><dd><?php if(post_custom('time')): ?><?php the_field("oa", $post->ID); ?><?php endif; ?></dd></dl>
316
+
317
+ </section>
318
+
319
+
320
+
321
+ <section class="property">
322
+
323
+ <table class="type1">
324
+
325
+ <thead>
326
+
327
+ <tr>
328
+
329
+ <th scope="cols">階数</th>
330
+
331
+ <th scope="cols">面積</th>
332
+
333
+ <th scope="cols">敷金</th>
334
+
335
+ <th scope="cols">賃料(税別)</th>
336
+
337
+ <th scope="cols">共益費(税別)</th>
338
+
339
+ <th scope="cols">礼金</th>
340
+
341
+ <th scope="cols">契約期間</th>
342
+
343
+ <th scope="cols">入居日</th>
344
+
345
+ <th scope="cols">天井高</th>
346
+
347
+ <th scope="cols">備考</th>
348
+
349
+ </tr>
350
+
351
+ </thead>
352
+
353
+
354
+
355
+ <tbody>
356
+
357
+ <!-- テナント情報 -->
358
+
359
+ <?php if(post_custom('rent') == '空き'): ?>
360
+
361
+ <tr>
362
+
363
+ <?php if(post_custom('kai')): ?>
364
+
365
+ <td><?php the_field("kai", $post->ID); ?></td>
366
+
367
+ <?php else : ?><td><span>応相談</span></td>
368
+
369
+ <?php endif; ?>
370
+
371
+ <?php if(post_custom('kyoeki')): ?>
372
+
373
+ <td><?php the_field("tubo", $post->ID); ?>坪</td>
374
+
375
+ <td>12ヵ月</td>
376
+
377
+ <?php else : ?><td><span>応相談</span></td>
378
+
379
+ <?php endif; ?>
380
+
381
+ <?php if(post_custom('yachin')): ?>
382
+
383
+ <td><?php echo number_format(get_post_meta($post->ID,'yachin',true));?>円</td>
384
+
385
+ <?php else : ?><td><span>応相談</span></td>
386
+
387
+ <?php endif; ?>
388
+
389
+ <?php if(post_custom('kyoeki')): ?>
390
+
391
+ <td><?php echo number_format(get_post_meta($post->ID,'kyoeki',true));?>円</td>
392
+
393
+ <?php else : ?><td>-</td>
394
+
395
+ <?php endif; ?>
396
+
397
+ <?php if(post_custom('reien')): ?>
398
+
399
+ <td><?php the_field("reien", $post->ID); ?></td>
400
+
401
+ <?php else : ?><td>応相談</td>
402
+
403
+ <?php endif; ?>
404
+
405
+ <td>2年間</td>
406
+
407
+ <?php if(post_custom('checkin')): ?>
408
+
409
+ <td><?php the_field("checkin", $post->ID); ?></td>
410
+
411
+ <?php else : ?><td>応相談</td>
412
+
413
+ <?php endif; ?>
414
+
415
+ <?php if(post_custom('high')): ?>
416
+
417
+ <td><?php the_field("high", $post->ID); ?></td>
418
+
419
+ <?php else : ?><td>応相談</td>
420
+
421
+ <?php endif; ?>
422
+
423
+ <?php if(post_custom('biko')): ?>
424
+
425
+ <td><?php the_field("biko", $post->ID); ?></td>
426
+
427
+ <?php else : ?><td>応相談</td>
428
+
429
+ <?php endif; ?>
430
+
431
+ </tr>
432
+
433
+ <?php endif; ?>
434
+
435
+ <!-- //テナント情報 -->
436
+
437
+ </tbody>
438
+
439
+ </table>
440
+
441
+ </section>
442
+
443
+
444
+
445
+ <?php endwhile; else: ?>
446
+
447
+ <p><?php echo "お探しの記事、ページは見つかりませんでした。"; ?></p>
448
+
449
+ <?php endif; ?>
450
+
451
+
452
+
453
+ ```
454
+
455
+
456
+
457
+ ※ 投稿には設置されており、single.phpでは出力していないカスタムフィールドを、印刷用では利用していますのでご了承ください。