質問編集履歴

2

コードの追記

2019/06/11 12:44

投稿

kyaapo
kyaapo

スコア17

test CHANGED
File without changes
test CHANGED
@@ -122,6 +122,108 @@
122
122
 
123
123
 
124
124
 
125
+
126
+
127
+
128
+
129
+
130
+
131
+
132
+
133
+ 【21:42記載】
134
+
135
+ <?php
136
+
137
+ $taxonomy_name = 'category-rec';
138
+
139
+ $taxonomys = get_terms($taxonomy_name);
140
+
141
+ if(!is_wp_error($taxonomys) && count($taxonomys)):
142
+
143
+
144
+
145
+ foreach($taxonomys as $taxonomy):
146
+
147
+ $tax_posts = get_posts(array('post_type' => get_post_type(), 'taxonomy' => $taxonomy_name,
148
+
149
+ 'term' => $taxonomy->slug ) );
150
+
151
+ if($tax_posts):
152
+
153
+ ?>
154
+
155
+ <h2><span><?php echo esc_html($taxonomy->name); ?></span></h2>
156
+
157
+
158
+
159
+ <table>
160
+
161
+ <tr>
162
+
163
+ <th>募集職種</th>
164
+
165
+ <td>
166
+
167
+ <?php
168
+
169
+ $args = array(
170
+
171
+ 'numberposts' => -1,//全てのpostを持ってくる
172
+
173
+ 'post_type' => 'recruit-rec',
174
+
175
+ 'orderby' => 'post_date',//日付順
176
+
177
+ 'order' => 'ASC',//投稿を古い順に表示
178
+
179
+ 'recruit-rec' => $cat->slug
180
+
181
+ );
182
+
183
+ $my_posts = get_posts( $args );
184
+
185
+ if ( $my_posts ) { // 該当する投稿があったら回す
186
+
187
+ foreach ( $my_posts as $post ) :
188
+
189
+ setup_postdata( $post );
190
+
191
+ ?>
192
+
193
+ <a href="<?php the_permalink(); ?>">
194
+
195
+ <?php the_title(); ?>
196
+
197
+ </a>
198
+
199
+
200
+
201
+
202
+
203
+ <?php
204
+
205
+ endforeach;} else {}
206
+
207
+ wp_reset_postdata();
208
+
209
+ ?>
210
+
211
+ </td>
212
+
213
+ </tr>
214
+
215
+ </table>
216
+
217
+ <?php endif; endforeach; endif; ?>
218
+
219
+
220
+
221
+
222
+
223
+
224
+
225
+
226
+
125
227
  ```
126
228
 
127
229
 
@@ -175,91 +277,3 @@
175
277
 
176
278
 
177
279
  ここにより詳細な情報を記載してください。
178
-
179
-
180
-
181
- 【21:42記載】
182
-
183
- <?php
184
-
185
- $taxonomy_name = 'category-rec';
186
-
187
- $taxonomys = get_terms($taxonomy_name);
188
-
189
- if(!is_wp_error($taxonomys) && count($taxonomys)):
190
-
191
-
192
-
193
- foreach($taxonomys as $taxonomy):
194
-
195
- $tax_posts = get_posts(array('post_type' => get_post_type(), 'taxonomy' => $taxonomy_name,
196
-
197
- 'term' => $taxonomy->slug ) );
198
-
199
- if($tax_posts):
200
-
201
- ?>
202
-
203
- <h2><span><?php echo esc_html($taxonomy->name); ?></span></h2>
204
-
205
-
206
-
207
- <table>
208
-
209
- <tr>
210
-
211
- <th>募集職種</th>
212
-
213
- <td>
214
-
215
- <?php
216
-
217
- $args = array(
218
-
219
- 'numberposts' => -1,//全てのpostを持ってくる
220
-
221
- 'post_type' => 'recruit-rec',
222
-
223
- 'orderby' => 'post_date',//日付順
224
-
225
- 'order' => 'ASC',//投稿を古い順に表示
226
-
227
- 'recruit-rec' => $cat->slug
228
-
229
- );
230
-
231
- $my_posts = get_posts( $args );
232
-
233
- if ( $my_posts ) { // 該当する投稿があったら回す
234
-
235
- foreach ( $my_posts as $post ) :
236
-
237
- setup_postdata( $post );
238
-
239
- ?>
240
-
241
- <a href="<?php the_permalink(); ?>">
242
-
243
- <?php the_title(); ?>
244
-
245
- </a>
246
-
247
-
248
-
249
-
250
-
251
- <?php
252
-
253
- endforeach;} else {}
254
-
255
- wp_reset_postdata();
256
-
257
- ?>
258
-
259
- </td>
260
-
261
- </tr>
262
-
263
- </table>
264
-
265
- <?php endif; endforeach; endif; ?>

1

コードの修正

2019/06/11 12:44

投稿

kyaapo
kyaapo

スコア17

test CHANGED
File without changes
test CHANGED
@@ -175,3 +175,91 @@
175
175
 
176
176
 
177
177
  ここにより詳細な情報を記載してください。
178
+
179
+
180
+
181
+ 【21:42記載】
182
+
183
+ <?php
184
+
185
+ $taxonomy_name = 'category-rec';
186
+
187
+ $taxonomys = get_terms($taxonomy_name);
188
+
189
+ if(!is_wp_error($taxonomys) && count($taxonomys)):
190
+
191
+
192
+
193
+ foreach($taxonomys as $taxonomy):
194
+
195
+ $tax_posts = get_posts(array('post_type' => get_post_type(), 'taxonomy' => $taxonomy_name,
196
+
197
+ 'term' => $taxonomy->slug ) );
198
+
199
+ if($tax_posts):
200
+
201
+ ?>
202
+
203
+ <h2><span><?php echo esc_html($taxonomy->name); ?></span></h2>
204
+
205
+
206
+
207
+ <table>
208
+
209
+ <tr>
210
+
211
+ <th>募集職種</th>
212
+
213
+ <td>
214
+
215
+ <?php
216
+
217
+ $args = array(
218
+
219
+ 'numberposts' => -1,//全てのpostを持ってくる
220
+
221
+ 'post_type' => 'recruit-rec',
222
+
223
+ 'orderby' => 'post_date',//日付順
224
+
225
+ 'order' => 'ASC',//投稿を古い順に表示
226
+
227
+ 'recruit-rec' => $cat->slug
228
+
229
+ );
230
+
231
+ $my_posts = get_posts( $args );
232
+
233
+ if ( $my_posts ) { // 該当する投稿があったら回す
234
+
235
+ foreach ( $my_posts as $post ) :
236
+
237
+ setup_postdata( $post );
238
+
239
+ ?>
240
+
241
+ <a href="<?php the_permalink(); ?>">
242
+
243
+ <?php the_title(); ?>
244
+
245
+ </a>
246
+
247
+
248
+
249
+
250
+
251
+ <?php
252
+
253
+ endforeach;} else {}
254
+
255
+ wp_reset_postdata();
256
+
257
+ ?>
258
+
259
+ </td>
260
+
261
+ </tr>
262
+
263
+ </table>
264
+
265
+ <?php endif; endforeach; endif; ?>