回答編集履歴

2

修正

2018/03/22 15:09

投稿

退会済みユーザー
test CHANGED
@@ -86,8 +86,6 @@
86
86
 
87
87
  <?php //念の為タグの有無確認してaの閉じ
88
88
 
89
- $posttags = get_the_tags();
90
-
91
89
  if ( $posttags )
92
90
 
93
91
  echo '</a>';

1

追記

2018/03/22 15:09

投稿

退会済みユーザー
test CHANGED
@@ -7,3 +7,105 @@
7
7
 
8
8
 
9
9
  [テンプレートタグ/the tags](https://wpdocs.osdn.jp/%E3%83%86%E3%83%B3%E3%83%97%E3%83%AC%E3%83%BC%E3%83%88%E3%82%BF%E3%82%B0/the_tags)
10
+
11
+
12
+
13
+
14
+
15
+ **追記**
16
+
17
+ こういうことでしょうか?
18
+
19
+ ```
20
+
21
+ $newslist = get_posts(array(
22
+
23
+ 'post_type' => 'brand',
24
+
25
+ 'posts_per_page' => -1,
26
+
27
+ 'category_name' => 'fashion'
28
+
29
+ ));
30
+
31
+ ?>
32
+
33
+ <?php if(!empty($newslist)) :?>
34
+
35
+ <?php
36
+
37
+ foreach ( $newslist as $post ) :
38
+
39
+ setup_postdata( $post );
40
+
41
+ ?>
42
+
43
+
44
+
45
+ <?php
46
+
47
+ $posttags = get_the_tags();
48
+
49
+ if ( $posttags ) //タグアーカイブのURL 念の為タグの有無確認してaタグ出力
50
+
51
+ echo '<a href="'.get_tag_link( $posttags[0]->term_id ).'">';
52
+
53
+ ?>
54
+
55
+
56
+
57
+ <div class="test col-xs-12 col-sm-4 col-md-4 col-lg-4 col-xl-4 clearfix pa0">
58
+
59
+ <p class="floatL imgCont">
60
+
61
+ <?php the_post_thumbnail( array(114,114) ); ?>
62
+
63
+ </p>
64
+
65
+
66
+
67
+ <div class="floatL text">
68
+
69
+ <p class="eng">
70
+
71
+ <?php the_field("eng", $post->ID); ?>
72
+
73
+ </p>
74
+
75
+ <p class="brandJapanese">
76
+
77
+ <?php the_field("japa-name", $post->ID); ?>
78
+
79
+ </p>
80
+
81
+ </div><!--/floatL-->
82
+
83
+ </div><!--/test-->
84
+
85
+
86
+
87
+ <?php //念の為タグの有無確認してaの閉じ
88
+
89
+ $posttags = get_the_tags();
90
+
91
+ if ( $posttags )
92
+
93
+ echo '</a>';
94
+
95
+ ?>
96
+
97
+
98
+
99
+ <?php endforeach;
100
+
101
+ wp_reset_postdata();
102
+
103
+ ?>
104
+
105
+ <?php else:?>
106
+
107
+ <p id="nopost">記事はありません。</p>
108
+
109
+ <?php endif;?>
110
+
111
+ ```