質問編集履歴
4
今回のソースに対する質問
title
CHANGED
|
File without changes
|
body
CHANGED
|
@@ -49,8 +49,10 @@
|
|
|
49
49
|
get_postsでの方法でも構いません。
|
|
50
50
|
|
|
51
51
|
|
|
52
|
-
###
|
|
52
|
+
###追加質問
|
|
53
53
|
回答してくださったmizさんの方法で大体の実現はできたのですが、最初に記述した
|
|
54
|
+
[https://teratail.com/questions/67797](https://teratail.com/questions/67797)
|
|
55
|
+
|
|
54
56
|
```
|
|
55
57
|
<?php
|
|
56
58
|
$args = array(
|
|
@@ -88,15 +90,13 @@
|
|
|
88
90
|
?>
|
|
89
91
|
```
|
|
90
92
|
とarchive.phpに記述しました。
|
|
91
|
-
が、これだと
|
|
93
|
+
実現はできましたが、これだと
|
|
92
94
|
|
|
93
95
|
最初に書いた条件の
|
|
94
96
|
|
|
95
97
|
```
|
|
96
98
|
<?php
|
|
97
99
|
$args = array(
|
|
98
|
-
'post_type' => array( 'custom01','custom02','custom03'),
|
|
99
|
-
'paged' => $paged,
|
|
100
100
|
'meta_key' => 'first_date',
|
|
101
101
|
'orderby' => 'first_date',
|
|
102
102
|
'order' => 'ASC',
|
|
@@ -106,6 +106,14 @@
|
|
|
106
106
|
<?php query_posts( $args ); ?>
|
|
107
107
|
```
|
|
108
108
|
が実現されません。
|
|
109
|
+
一部カスタム投稿タイプは非公開になっている情報を取得したたいため、上記記述をしています。
|
|
109
110
|
|
|
111
|
+
コメントにも書いているのですが、
|
|
112
|
+
今回イベント情報ページで、
|
|
113
|
+
0. イベントが終わり次第、非公開になる
|
|
114
|
+
0. 非公開になったイベント情報をバイオグラフィに自動的に表示したい
|
|
110
115
|
|
|
116
|
+
という意図です。
|
|
117
|
+
当方でも調べてはいるものの、うまく実現できないため、再質問とさせてください。
|
|
118
|
+
|
|
111
119
|
よろしくお願いいたします
|
3
今回のソースに対する質問
title
CHANGED
|
File without changes
|
body
CHANGED
|
@@ -48,4 +48,64 @@
|
|
|
48
48
|
そこは、無視していただければ幸いです。
|
|
49
49
|
get_postsでの方法でも構いません。
|
|
50
50
|
|
|
51
|
+
|
|
52
|
+
###質問追加
|
|
53
|
+
回答してくださったmizさんの方法で大体の実現はできたのですが、最初に記述した
|
|
54
|
+
```
|
|
55
|
+
<?php
|
|
56
|
+
$args = array(
|
|
57
|
+
'post_type' => array( 'custom01','custom02','custom03'),
|
|
58
|
+
'paged' => $paged,
|
|
59
|
+
'meta_key' => 'first_date',
|
|
60
|
+
'orderby' => 'first_date',
|
|
61
|
+
'order' => 'ASC',
|
|
62
|
+
'post_status' => array('private','publish')
|
|
63
|
+
);
|
|
64
|
+
?>
|
|
65
|
+
<?php query_posts( $args ); ?>
|
|
66
|
+
<?php
|
|
67
|
+
if ( have_posts() ):
|
|
68
|
+
while ( have_posts() ):
|
|
69
|
+
the_post();
|
|
70
|
+
get_template_part( 'content-custom01' );
|
|
71
|
+
endwhile;
|
|
72
|
+
endif;
|
|
73
|
+
wp_reset_query();
|
|
74
|
+
?>
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
では年別アーカイブに別の年まで入ってしまったため、
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
<?php
|
|
81
|
+
if ( have_posts() ):
|
|
82
|
+
while ( have_posts() ):
|
|
83
|
+
the_post();
|
|
84
|
+
get_template_part( 'content-custom01' );
|
|
85
|
+
endwhile;
|
|
86
|
+
endif;
|
|
87
|
+
wp_reset_query();
|
|
88
|
+
?>
|
|
89
|
+
```
|
|
90
|
+
とarchive.phpに記述しました。
|
|
91
|
+
が、これだと
|
|
92
|
+
|
|
93
|
+
最初に書いた条件の
|
|
94
|
+
|
|
95
|
+
```
|
|
96
|
+
<?php
|
|
97
|
+
$args = array(
|
|
98
|
+
'post_type' => array( 'custom01','custom02','custom03'),
|
|
99
|
+
'paged' => $paged,
|
|
100
|
+
'meta_key' => 'first_date',
|
|
101
|
+
'orderby' => 'first_date',
|
|
102
|
+
'order' => 'ASC',
|
|
103
|
+
'post_status' => array('private','publish')
|
|
104
|
+
);
|
|
105
|
+
?>
|
|
106
|
+
<?php query_posts( $args ); ?>
|
|
107
|
+
```
|
|
108
|
+
が実現されません。
|
|
109
|
+
|
|
110
|
+
|
|
51
111
|
よろしくお願いいたします
|
2
説明の追加
title
CHANGED
|
File without changes
|
body
CHANGED
|
@@ -6,9 +6,17 @@
|
|
|
6
6
|
|
|
7
7
|
カスタムフィールドを使っているので、カスタムフィールドのデートピッカーで指定している日付でソートできたら尚いいです。
|
|
8
8
|
|
|
9
|
+
0. カスタム投稿タイプ「custom01」のアーカイブページを作成
|
|
10
|
+
0. 「custom01」の年別アーカイブページでcustom01、custom02、custom03の内容を一括表示
|
|
9
11
|
|
|
12
|
+
|
|
13
|
+
これで、下記ソースで強制的に一覧表示はできたのですが、
|
|
14
|
+
custom01の投稿数が少ないため、年別アーカイブページを作成すると2017/2016/2014/2002/という形で、
|
|
15
|
+
歯抜けのページができてしまいます。
|
|
16
|
+
歯抜けができないようにするためにはどうしたらいいのか教えて欲しいです。
|
|
17
|
+
|
|
18
|
+
|
|
10
19
|
###該当のソースコード
|
|
11
|
-
当然ですが、これだとうまく実行されずに困っています。
|
|
12
20
|
|
|
13
21
|
```
|
|
14
22
|
<?php
|
|
@@ -26,7 +34,7 @@
|
|
|
26
34
|
if ( have_posts() ):
|
|
27
35
|
while ( have_posts() ):
|
|
28
36
|
the_post();
|
|
29
|
-
get_template_part( 'content-
|
|
37
|
+
get_template_part( 'content-custom01' );
|
|
30
38
|
endwhile;
|
|
31
39
|
endif;
|
|
32
40
|
wp_reset_query();
|
1
文法の修正
title
CHANGED
|
@@ -1,1 +1,1 @@
|
|
|
1
|
-
複数のカスタム投稿タイプを混在させた年別アーカイブページを作りたい
|
|
1
|
+
複数のカスタム投稿タイプを混在させた年別アーカイブ(一覧)ページを作りたい
|
body
CHANGED
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
最初面倒だったので、'posts_per_page' => -1で全件表示しようとしていたのですが、
|
|
5
5
|
表示するのにも時間がかかってしまったので、改めて年別アーカイブページページを作りたいです。
|
|
6
6
|
|
|
7
|
+
カスタムフィールドを使っているので、カスタムフィールドのデートピッカーで指定している日付でソートできたら尚いいです。
|
|
7
8
|
|
|
9
|
+
|
|
8
10
|
###該当のソースコード
|
|
9
11
|
当然ですが、これだとうまく実行されずに困っています。
|
|
10
12
|
|