質問編集履歴
2
誤字
title
CHANGED
File without changes
|
body
CHANGED
@@ -102,8 +102,8 @@
|
|
102
102
|
$query->set( 'thisyear',$thisyear);
|
103
103
|
$query->set( 'thismon',$thismon);
|
104
104
|
$query->set( 'orderby', 'meta_value' );
|
105
|
-
$query->set( 'meta_key','
|
105
|
+
$query->set( 'meta_key','event_date');
|
106
|
-
$query->set( 'post_type','
|
106
|
+
$query->set( 'post_type','event');
|
107
107
|
}
|
108
108
|
}
|
109
109
|
add_action( 'pre_get_posts', 'change_sort_order' );
|
1
文中のコメント消去
title
CHANGED
File without changes
|
body
CHANGED
@@ -8,11 +8,9 @@
|
|
8
8
|
**1.年別アーカイブページのURLが正しくならない**
|
9
9
|
|
10
10
|
(カスタム投稿アーカイブページ ***.com/wp/event/)
|
11
|
-
|
12
11
|
↓ ソート
|
13
12
|
|
14
13
|
現在の年別ソートURL ***.com/wp/2020/?meta_key=event_date
|
15
|
-
|
16
14
|
こうしたいURL .com/wp/event/2020/
|
17
15
|
|
18
16
|
**2.フィールドによるアーカイブページ(年別)が作られない**
|
@@ -20,6 +18,7 @@
|
|
20
18
|
|
21
19
|
### 該当のソースコード
|
22
20
|
|
21
|
+
### functions.php
|
23
22
|
```php
|
24
23
|
/カスタムフィールドの値で月別アーカイブ
|
25
24
|
function my_get_year_archives( $args = '' ) {
|
@@ -64,7 +63,7 @@
|
|
64
63
|
$arcresults = $cache[ $key ];
|
65
64
|
}
|
66
65
|
if ( $arcresults ) {
|
67
|
-
|
66
|
+
$afterafter = $after;
|
68
67
|
foreach ( (array) $arcresults as $arcresult ) {
|
69
68
|
$url = add_query_arg( array( 'meta_key' => $date_field ), get_year_link( $arcresult->year) );
|
70
69
|
$text = sprintf( '%d', $arcresult->year ).'年';
|