回答編集履歴
1
全角スペースが混じってるという最低なコードでした。。。すみません。
answer
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
//functions.phpに追記
|
|
23
23
|
add_filter( 'widget_archives_args','my_topics_archives');
|
|
24
24
|
function my_topics_archives( $content ){
|
|
25
|
-
$content['post_type']
|
|
25
|
+
$content['post_type'] = 'topics';
|
|
26
26
|
return $content;
|
|
27
27
|
}
|
|
28
28
|
```
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
function my_topics_archives( $content ){
|
|
36
36
|
|
|
37
37
|
//topics, post投稿タイプのページではそれぞれの投稿タイプの月別アーカイブにする。
|
|
38
|
+
//ここら辺のifの判定内容については、状況によって書き換えてください。例:if( is_home() )
|
|
38
|
-
if( in_array( $post_type = get_post_type(), array( 'topics', 'post' ) ){
|
|
39
|
+
if( in_array( $post_type = get_post_type(), array( 'topics', 'post' ) ) ){
|
|
39
|
-
|
|
40
|
-
$content['post_type']
|
|
40
|
+
$content['post_type'] = $post_type;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
return $content;
|