質問編集履歴

2

使用プラグインの追記とコードを実際のものに変更しました。

2018/06/19 07:26

投稿

yamana
yamana

スコア118

test CHANGED
File without changes
test CHANGED
@@ -80,7 +80,7 @@
80
80
 
81
81
 
82
82
 
83
- ### 該当のソースコード
83
+ ### 問題のソースコード
84
84
 
85
85
 
86
86
 
@@ -116,6 +116,64 @@
116
116
 
117
117
  <h3 id="<?php echo $seriesval; ?>series"><?php echo $seriesval ?>.series</h3>
118
118
 
119
+ <div class="collection_block">
120
+
121
+ <?php if ( get_post_meta( get_the_ID(), 'main_img', true ) ) : ?>
122
+
123
+ <?php
124
+
125
+ $src02 = wp_get_attachment_image_src($cfs->get('main_img'), 'size_collection');
126
+
127
+ ?>
128
+
129
+ <input type="hidden" value="<?php echo $src02[0];?>" class="main_img">
130
+
131
+ <?php endif;?>
132
+
133
+ <?php if ( get_post_meta( get_the_ID(), 'side_img', true ) ) : ?>
134
+
135
+ <?php
136
+
137
+ $src = wp_get_attachment_image_src($cfs->get('side_img'), 'size_collection');
138
+
139
+ ?>
140
+
141
+ <input type="hidden" value="<?php echo $src[0];?>" class="side_img">
142
+
143
+ <?php endif;?>
144
+
145
+ <a href="<?php the_permalink();?>">
146
+
147
+ <?php if ( get_post_meta( get_the_ID(), 'main_img', true ) ) : ?>
148
+
149
+ <?php
150
+
151
+ $attachment_id = $cfs->get('main_img');
152
+
153
+ ?>
154
+
155
+ <?php
156
+
157
+ $attachment_image = wp_get_attachment_image( $attachment_id );
158
+
159
+ echo wp_get_attachment_image(post_custom('main_img'),'size_collection');
160
+
161
+ ?>
162
+
163
+ <?php else :?>
164
+
165
+ <img src=<img src="http://placehold.it/700x400?text=noimage">" alt="<?php the_title();?>">
166
+
167
+ <?php endif;?>
168
+
169
+ <p class="entry_item_name"><?php the_title();?></p>
170
+
171
+ </a>
172
+
173
+ </div>
174
+
175
+
176
+
119
177
  <?php endforeach; wp_reset_postdata(); endforeach; ?>
120
178
 
121
179
  ```
@@ -125,3 +183,17 @@
125
183
 
126
184
 
127
185
  よろしくお願いいたします。
186
+
187
+
188
+
189
+
190
+
191
+ ### 補足情報(FW/ツールのバージョンなど)
192
+
193
+ カスタムフィールドの値は
194
+
195
+ Custom Field Suite
196
+
197
+ というプラグインで埋め込みしています。
198
+
199
+ $mypostsの中身は該当シリーズ(ループ実行中)の記事データが配列形式で格納されています。

1

現在の状態を追記しました。

2018/06/19 07:26

投稿

yamana
yamana

スコア118

test CHANGED
File without changes
test CHANGED
@@ -29,6 +29,54 @@
29
29
  .
30
30
 
31
31
  ーーーーーーーーーーーーーーーーーーーーーーーーーーーー
32
+
33
+ ### 発生している問題・エラーメッセージ
34
+
35
+
36
+
37
+ 現状下記のようになってしまっているので
38
+
39
+ 理想的な形になりません。
40
+
41
+ ーーーーーーーーーーーーーーーーーーーーーーーーーーーー
42
+
43
+ A.series
44
+
45
+ 商品A
46
+
47
+ A.series
48
+
49
+ 商品A
50
+
51
+ A.series
52
+
53
+ 商品A
54
+
55
+
56
+
57
+ B.series
58
+
59
+ 商品B
60
+
61
+ B.series
62
+
63
+ 商品B
64
+
65
+ B.series
66
+
67
+ 商品B
68
+
69
+ .
70
+
71
+ .
72
+
73
+ .
74
+
75
+ ーーーーーーーーーーーーーーーーーーーーーーーーーーーー
76
+
77
+
78
+
79
+
32
80
 
33
81
 
34
82