質問編集履歴

4

今回のソースに対する質問

2017/04/01 09:18

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -100,10 +100,14 @@
100
100
 
101
101
 
102
102
 
103
- ###質問追加
103
+ ###追加質問
104
104
 
105
105
  回答してくださったmizさんの方法で大体の実現はできたのですが、最初に記述した
106
106
 
107
+ [https://teratail.com/questions/67797](https://teratail.com/questions/67797)
108
+
109
+
110
+
107
111
  ```
108
112
 
109
113
  <?php
@@ -178,7 +182,7 @@
178
182
 
179
183
  とarchive.phpに記述しました。
180
184
 
181
- が、これだと
185
+ 実現はできましたが、これだと
182
186
 
183
187
 
184
188
 
@@ -192,10 +196,6 @@
192
196
 
193
197
  $args = array(
194
198
 
195
- 'post_type' => array( 'custom01','custom02','custom03'),
196
-
197
- 'paged' => $paged,
198
-
199
199
  'meta_key' => 'first_date',
200
200
 
201
201
  'orderby' => 'first_date',
@@ -214,7 +214,23 @@
214
214
 
215
215
  が実現されません。
216
216
 
217
-
217
+ 一部カスタム投稿タイプは非公開になっている情報を取得したたいため、上記記述をしています。
218
+
219
+
220
+
221
+ コメントにも書いているのですが、
222
+
223
+ 今回イベント情報ページで、
224
+
225
+ 0. イベントが終わり次第、非公開になる
226
+
227
+ 0. 非公開になったイベント情報をバイオグラフィに自動的に表示したい
228
+
229
+
230
+
231
+ という意図です。
232
+
233
+ 当方でも調べてはいるものの、うまく実現できないため、再質問とさせてください。
218
234
 
219
235
 
220
236
 

3

今回のソースに対する質問

2017/04/01 09:18

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -98,4 +98,124 @@
98
98
 
99
99
 
100
100
 
101
+
102
+
103
+ ###質問追加
104
+
105
+ 回答してくださったmizさんの方法で大体の実現はできたのですが、最初に記述した
106
+
107
+ ```
108
+
109
+ <?php
110
+
111
+ $args = array(
112
+
113
+ 'post_type' => array( 'custom01','custom02','custom03'),
114
+
115
+ 'paged' => $paged,
116
+
117
+ 'meta_key' => 'first_date',
118
+
119
+ 'orderby' => 'first_date',
120
+
121
+ 'order' => 'ASC',
122
+
123
+ 'post_status' => array('private','publish')
124
+
125
+ );
126
+
127
+ ?>
128
+
129
+ <?php query_posts( $args ); ?>
130
+
131
+ <?php
132
+
133
+ if ( have_posts() ):
134
+
135
+ while ( have_posts() ):
136
+
137
+ the_post();
138
+
139
+ get_template_part( 'content-custom01' );
140
+
141
+ endwhile;
142
+
143
+ endif;
144
+
145
+ wp_reset_query();
146
+
147
+ ?>
148
+
149
+ ```
150
+
151
+
152
+
153
+ では年別アーカイブに別の年まで入ってしまったため、
154
+
155
+
156
+
157
+ ```
158
+
159
+ <?php
160
+
161
+ if ( have_posts() ):
162
+
163
+ while ( have_posts() ):
164
+
165
+ the_post();
166
+
167
+ get_template_part( 'content-custom01' );
168
+
169
+ endwhile;
170
+
171
+ endif;
172
+
173
+ wp_reset_query();
174
+
175
+ ?>
176
+
177
+ ```
178
+
179
+ とarchive.phpに記述しました。
180
+
181
+ が、これだと
182
+
183
+
184
+
185
+ 最初に書いた条件の
186
+
187
+
188
+
189
+ ```
190
+
191
+ <?php
192
+
193
+ $args = array(
194
+
195
+ 'post_type' => array( 'custom01','custom02','custom03'),
196
+
197
+ 'paged' => $paged,
198
+
199
+ 'meta_key' => 'first_date',
200
+
201
+ 'orderby' => 'first_date',
202
+
203
+ 'order' => 'ASC',
204
+
205
+ 'post_status' => array('private','publish')
206
+
207
+ );
208
+
209
+ ?>
210
+
211
+ <?php query_posts( $args ); ?>
212
+
213
+ ```
214
+
215
+ が実現されません。
216
+
217
+
218
+
219
+
220
+
101
221
  よろしくお願いいたします

2

説明の追加

2017/04/01 09:12

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -14,11 +14,27 @@
14
14
 
15
15
 
16
16
 
17
+ 0. カスタム投稿タイプ「custom01」のアーカイブページを作成
18
+
19
+ 0. 「custom01」の年別アーカイブページでcustom01、custom02、custom03の内容を一括表示
20
+
21
+
22
+
23
+
24
+
25
+ これで、下記ソースで強制的に一覧表示はできたのですが、
26
+
27
+ custom01の投稿数が少ないため、年別アーカイブページを作成すると2017/2016/2014/2002/という形で、
28
+
29
+ 歯抜けのページができてしまいます。
30
+
31
+ 歯抜けができないようにするためにはどうしたらいいのか教えて欲しいです。
32
+
33
+
34
+
17
35
 
18
36
 
19
37
  ###該当のソースコード
20
-
21
- 当然ですが、これだとうまく実行されずに困っています。
22
38
 
23
39
 
24
40
 
@@ -54,7 +70,7 @@
54
70
 
55
71
  the_post();
56
72
 
57
- get_template_part( 'content-biography' );
73
+ get_template_part( 'content-custom01' );
58
74
 
59
75
  endwhile;
60
76
 

1

文法の修正

2017/03/31 02:39

投稿

退会済みユーザー
test CHANGED
@@ -1 +1 @@
1
- 複数のカスタム投稿タイプを混在させた年別アーカイブページを作りたい
1
+ 複数のカスタム投稿タイプを混在させた年別アーカイブ(一覧)ページを作りたい
test CHANGED
@@ -7,6 +7,10 @@
7
7
  最初面倒だったので、'posts_per_page' => -1で全件表示しようとしていたのですが、
8
8
 
9
9
  表示するのにも時間がかかってしまったので、改めて年別アーカイブページページを作りたいです。
10
+
11
+
12
+
13
+ カスタムフィールドを使っているので、カスタムフィールドのデートピッカーで指定している日付でソートできたら尚いいです。
10
14
 
11
15
 
12
16