質問編集履歴

4

■ 使用したプラグインと作業過程の情報を増やしました。

2016/09/14 02:36

投稿

SuzukiToshiyasu
SuzukiToshiyasu

スコア40

test CHANGED
File without changes
test CHANGED
@@ -32,7 +32,7 @@
32
32
 
33
33
  「Advanced Custom Fields」を使用しています。
34
34
 
35
- functions.phpに下記情報を入れて投稿タイプを登録し、archive-kamei.phpに表示されるよう記述しています。
35
+ functions.phpに下記情報を入れて投稿タイプを登録し、archive-kamei.phpに表示されるよう記述しています。字数制限のため記述ができませんでしたが、taxonomy.phpにもarchive-kamei.phpと同じソースコードを記述し、アーカイブページが作成されるよう設定してあります。
36
36
 
37
37
 
38
38
 

3

「参考サイト」⇛「当該サイト」に変更しました。「該当ページ」⇛「当該ページ」に変更しました。

2016/09/14 02:36

投稿

SuzukiToshiyasu
SuzukiToshiyasu

スコア40

test CHANGED
File without changes
test CHANGED
@@ -1,6 +1,6 @@
1
- 参考サイト : [http://test.site-madoguchi.com/](http://test.site-madoguchi.com/)
1
+ 当該サイト : [http://test.site-madoguchi.com/](http://test.site-madoguchi.com/)
2
-
2
+
3
- ページ : [http://test.site-madoguchi.com/archives/kamei/kameicat/%E3%82%B0%E3%83%AB%E3%83%A1](http://test.site-madoguchi.com/archives/kamei/kameicat/%E3%82%B0%E3%83%AB%E3%83%A1)
3
+ 該ページ : [http://test.site-madoguchi.com/archives/kamei/kameicat/%E3%82%B0%E3%83%AB%E3%83%A1](http://test.site-madoguchi.com/archives/kamei/kameicat/%E3%82%B0%E3%83%AB%E3%83%A1)
4
4
 
5
5
 
6
6
 

2

使用したプラグインと作業過程の情報を追記しました。

2016/09/14 02:32

投稿

SuzukiToshiyasu
SuzukiToshiyasu

スコア40

test CHANGED
File without changes
test CHANGED
@@ -26,7 +26,131 @@
26
26
 
27
27
 
28
28
 
29
+ ■ 使用したプラグインと作業過程
30
+
31
+
32
+
33
+ 「Advanced Custom Fields」を使用しています。
34
+
35
+ functions.phpに下記情報を入れて投稿タイプを登録し、archive-kamei.phpに表示されるよう記述しています。
36
+
37
+
38
+
39
+ ■ functions.php
40
+
29
- ■ 該当するページのコード その1 taxonomy.php
41
+ ``` register_taxonomy(
42
+
43
+ 'newsinfocat',// 新規カスタムタクソノミー名
44
+
45
+ 'newsinfo',// 新規カスタムタクソノミーを反映させる投稿タイプの定義名
46
+
47
+ array(
48
+
49
+ 'label' => __( 'newsinfocat' ),// 表示するカスタムタクソノミー名
50
+
51
+ 'rewrite' => array( 'slug' => 'newsinfocat' ),// カスタムタクソノミースラッグ名
52
+
53
+ 'show_ui' => true,
54
+
55
+ 'hierarchical' => true,'
56
+
57
+ query_var' => true)
58
+
59
+ );
60
+
61
+ register_post_type('kamei',
62
+
63
+ array(
64
+
65
+ 'labels' => array(
66
+
67
+ 'name' => '加盟店登録',
68
+
69
+ 'singular_name' => '加盟店登録',
70
+
71
+ ),
72
+
73
+ 'public' => true,
74
+
75
+ 'menu_position' => 5,
76
+
77
+ 'has_archive' => true,
78
+
79
+ 'publicly_queryable' => true,
80
+
81
+ 'supports' => array('title','editor','excerpt','thumbnail','custom-fields',),
82
+
83
+ 'taxonomies' => array('kameicat'),
84
+
85
+ )
86
+
87
+ );
88
+
89
+ register_taxonomy(
90
+
91
+ 'kameicat',// 新規カスタムタクソノミー名
92
+
93
+ 'kamei',// 新規カスタムタクソノミーを反映させる投稿タイプの定義名
94
+
95
+ array(
96
+
97
+ 'label' => __( 'kameicat' ),// 表示するカスタムタクソノミー名
98
+
99
+ 'rewrite' => array( 'slug' => 'kameicat' ),// カスタムタクソノミースラッグ名
100
+
101
+ 'show_ui' => true,
102
+
103
+ 'hierarchical' => true,'
104
+
105
+ query_var' => true)
106
+
107
+ );
108
+
109
+ register_post_type('hikamei',
110
+
111
+ array(
112
+
113
+ 'labels' => array(
114
+
115
+ 'name' => 'その他',
116
+
117
+ 'singular_name' => 'その他',
118
+
119
+ ),
120
+
121
+ 'public' => true,
122
+
123
+ 'menu_position' => 5,
124
+
125
+ 'has_archive' => true,
126
+
127
+ 'publicly_queryable' => true,
128
+
129
+ 'supports' => array(
130
+
131
+ 'title',
132
+
133
+ 'editor',
134
+
135
+ 'excerpt',
136
+
137
+ 'thumbnail',
138
+
139
+ 'custom-fields',
140
+
141
+ ),
142
+
143
+ )
144
+
145
+ );
146
+
147
+ コード
148
+
149
+ ```
150
+
151
+
152
+
153
+ ■ archive-kamei.php
30
154
 
31
155
 
32
156
 
@@ -54,11 +178,7 @@
54
178
 
55
179
  <div class="innerleft">
56
180
 
57
- <a href="<?php the_permalink(); ?>">
181
+ <a href="<?php the_permalink(); ?>"><img src="<?php if( get_field('image1')): ?>
58
-
59
- <img src="
60
-
61
- <?php if( get_field('image1')): ?>
62
182
 
63
183
  <?php the_field('image1'); ?>
64
184
 
@@ -66,7 +186,7 @@
66
186
 
67
187
  /wp-content/uploads/2016/09/東口商店街.png
68
188
 
69
- <?php endif; ?>" alt="<?php the_field('store'); ?>" class="wh150 image2"></a>
189
+ <?php endif; ?>" alt="<?php the_field('store'); ?>" alt="<?php the_field('store'); ?>" class="wh150 image2"></a>
70
190
 
71
191
  <a href="<?php the_permalink(); ?>"><button class="shousai">詳細を見る</button></a>
72
192
 
@@ -106,7 +226,7 @@
106
226
 
107
227
  <div class="article">
108
228
 
109
- <p>現在お知らせはありません。</p>
229
+ <p>現在該当するデータがございません。</p>
110
230
 
111
231
  <!-- /.article --></div>
112
232
 
@@ -158,7 +278,7 @@
158
278
 
159
279
  <div class="article">
160
280
 
161
- <p>現在お知らせはありません。</p>
281
+ <p></p>
162
282
 
163
283
  <!-- /.article --></div>
164
284
 
@@ -257,233 +377,3 @@
257
377
  コード
258
378
 
259
379
  ```
260
-
261
-
262
-
263
- ■ 該当するページのコード その2 archive-kamei.php
264
-
265
-
266
-
267
- ```<?php get_header(); ?>
268
-
269
-
270
-
271
- <div class="wrapper sectionpage">
272
-
273
- <h2 id="obi1" style="margin: 0px auto 30px;" class="goan"><span style="color:#d6170c;font-weight:700;font-size:1.0em;">○ </span>お店のご案内</h2>
274
-
275
- <div class="storepostinner">
276
-
277
-
278
-
279
- <div class="content page73">
280
-
281
-
282
-
283
- <?php if (have_posts()) : ?>
284
-
285
- <?php while (have_posts()) : the_post(); ?>
286
-
287
- <div class="article wd50">
288
-
289
- <div class="innerleft">
290
-
291
- <a href="<?php the_permalink(); ?>"><img src="<?php if( get_field('image1')): ?>
292
-
293
- <?php the_field('image1'); ?>
294
-
295
- <?php else: ?>
296
-
297
- /wp-content/uploads/2016/09/東口商店街.png
298
-
299
- <?php endif; ?>" alt="<?php the_field('store'); ?>" alt="<?php the_field('store'); ?>" class="wh150 image2"></a>
300
-
301
- <a href="<?php the_permalink(); ?>"><button class="shousai">詳細を見る</button></a>
302
-
303
- </div>
304
-
305
- <div class="innerright">
306
-
307
- <p><?php echo get_the_term_list( $post->ID,'kameicat','<ul class="catname categorylist"><li>', '</li><li>','</li></ul>'); ?>
308
-
309
- </p>
310
-
311
- <h2 class="archivetitle"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
312
-
313
- <!--<p class="archivedes"><?php
314
-
315
- $text = mb_substr(get_field('message'),0,100,'utf-8');
316
-
317
- echo $text.'...';
318
-
319
- ?></p>-->
320
-
321
- <p class="archivedes">TEL : <?php the_field('phone'); ?></br>
322
-
323
- <?php the_field('address'); ?></br>
324
-
325
- <?php the_field('open'); ?></br>
326
-
327
- <?php the_field('time'); ?></p></br>
328
-
329
- </div>
330
-
331
- <!-- /.article --></div>
332
-
333
- <?php endwhile; ?>
334
-
335
- <?php else: ?>
336
-
337
- <div class="article">
338
-
339
- <p>現在該当するデータがございません。</p>
340
-
341
- <!-- /.article --></div>
342
-
343
- <?php endif; ?>
344
-
345
-
346
-
347
- <?php query_posts( array(
348
-
349
- 'post_type'=>'hikamei',
350
-
351
- ) ); ?>
352
-
353
- <?php if (have_posts()) : ?>
354
-
355
- <?php while (have_posts()) : the_post(); ?>
356
-
357
- <div class="article wd50">
358
-
359
- <div class="innerleft">
360
-
361
- <img src="http://test.site-madoguchi.com/wp-content/uploads/2016/09/東口商店街.png" alt="<?php the_field('store'); ?>" class="wh150 image2">
362
-
363
- </div>
364
-
365
- <div class="innerright">
366
-
367
- <p><?php echo get_the_term_list( $post->ID,'hikameicat','<ul class="catname categorylist"><li>', '</li><li>','</li></ul>'); ?>
368
-
369
- </p>
370
-
371
- <h2 class="archivetitle"><?php the_title(); ?></h2>
372
-
373
- <p class="archivedes">TEL : <?php the_field('phone'); ?></br>
374
-
375
- <?php the_field('address'); ?></br>
376
-
377
- <?php the_field('open'); ?></br>
378
-
379
- <?php the_field('time'); ?></p></br>
380
-
381
- </div>
382
-
383
- <!-- /.article --></div>
384
-
385
- <?php endwhile; ?>
386
-
387
- <?php else: ?>
388
-
389
- <div class="article">
390
-
391
- <p></p>
392
-
393
- <!-- /.article --></div>
394
-
395
-
396
-
397
- <?php endif; ?>
398
-
399
-
400
-
401
- </div>
402
-
403
- <?php get_sidebar(); ?>
404
-
405
-
406
-
407
- </div>
408
-
409
-
410
-
411
- </div> <!-- /wrapper -->
412
-
413
-
414
-
415
- <script>
416
-
417
- var catnameUl = document.getElementsByClassName('catname');
418
-
419
- i = 0;
420
-
421
- while(i<20) {
422
-
423
- catnameLi = catnameUl[i].childNodes;
424
-
425
- for (var l=0;l < 2;l++){
426
-
427
- catnameInnerText = catnameLi[l].innerText;
428
-
429
- var catnameText01 = ['グルメ','カフェ/喫茶','ファーストフード','中華/ラーメン','和食','居酒屋/バー','洋食','焼肉/韓国料理/エスニック'];
430
-
431
- catnameText02 = ['ライフスタイル','アミューズメント/ホビー','カラオケ/ライブハウス','カルチャースクール','映画館/劇場','趣味/生活/占い','音楽/映画/本'];
432
-
433
- catnameText03 = ["ファッション","ビッグストア","メンズ","レディース","キッズ","ジュエリー/アクセサリー/靴","その他"];
434
-
435
- catnameText04 = ["サービス","ビューティー/ヘアサロン","ホテル","メディカル","リラクゼーション","不動産/貸ビル","協力企業","金券ショップ/暮らし/質","銀行"];
436
-
437
- s = 0;
438
-
439
- while(s < 7){
440
-
441
- if (catnameInnerText.indexOf(catnameText01[s]) != -1) {
442
-
443
- catnameLi[0].className = 'catgsfl gourmet';
444
-
445
- catnameLi[1].className = 'catgsfl gourmet';
446
-
447
- }
448
-
449
- if (catnameInnerText.indexOf(catnameText02[s]) != -1) {
450
-
451
- catnameLi[0].className = 'catgsfl lifestyle';
452
-
453
- catnameLi[1].className = 'catgsfl lifestyle';
454
-
455
- }
456
-
457
- if (catnameInnerText.indexOf(catnameText03[s]) != -1) {
458
-
459
- catnameLi[0].className = 'catgsfl clothes';
460
-
461
- catnameLi[1].className = 'catgsfl clothes';
462
-
463
- }
464
-
465
- if (catnameInnerText.indexOf(catnameText04[s]) != -1) {
466
-
467
- catnameLi[0].className = 'catgsfl service';
468
-
469
- catnameLi[1].className = 'catgsfl service';
470
-
471
- }
472
-
473
- s++;
474
-
475
- }
476
-
477
- }
478
-
479
- i++;
480
-
481
- }
482
-
483
- </script>
484
-
485
- <?php get_footer(); ?>
486
-
487
- コード
488
-
489
- ```

1

該当するページのファイル名を追記しました。

2016/09/14 02:30

投稿

SuzukiToshiyasu
SuzukiToshiyasu

スコア40

test CHANGED
File without changes
test CHANGED
@@ -26,7 +26,7 @@
26
26
 
27
27
 
28
28
 
29
- ■ 該当するページのコード その1
29
+ ■ 該当するページのコード その1 taxonomy.php
30
30
 
31
31
 
32
32
 
@@ -260,7 +260,7 @@
260
260
 
261
261
 
262
262
 
263
- ■ 該当するページのコード その2
263
+ ■ 該当するページのコード その2 archive-kamei.php
264
264
 
265
265
 
266
266