Kaynağa Gözat

:bug: adding clay back in to material sort | #146

tags/0.9.0
J 4 yıl önce
ebeveyn
işleme
83dc7d0ae4

+ 11
- 13
plugins/cia-endpoints/includes/class.make-sortby.php Dosyayı Görüntüle

@@ -36,15 +36,16 @@ class Make_Sort_By extends WP_REST_Controller {
36 36
         
37 37
         if($this->post_type == 'artist') {
38 38
             //  Default to all materials
39
-            $tax_id_array = [3, 4, 5, 6, 7, 8];
39
+            $tax_id_array = [2, 3, 4, 5, 6, 7, 8];
40 40
 
41 41
             if ($params['materials']) {
42 42
                 $tax_id_array = explode( ',', $params['materials'] );
43 43
             }
44
-            // 3 clay
45
-            // 4 fiber
46
-            // 5 glass
47
-            // 6 metals
44
+            // 2 clay
45
+            // 3 fiber
46
+            // 4 glass
47
+            // 5 metals
48
+            // 6 other
48 49
             // 7 paper
49 50
             // 8 wood
50 51
             $args['tax_query'] = array(
@@ -57,7 +58,7 @@ class Make_Sort_By extends WP_REST_Controller {
57 58
         }
58 59
         
59 60
         if($params['episode']) {
60
-            $args['by'] = $params['episode'];
61
+            $args['p2p'] = $params['episode'];
61 62
         }
62 63
 
63 64
         return $args;
@@ -114,7 +115,7 @@ class Make_Sort_By extends WP_REST_Controller {
114 115
         $found_posts = $q->get_posts();
115 116
         wp_reset_postdata();
116 117
 
117
-        return new WP_REST_Response( $this->prepare_items_for_reponse($found_posts, false), 200 );
118
+        return new WP_REST_Response( $this->prepare_items_for_reponse($found_posts), 200 );
118 119
     }
119 120
     
120 121
     public function by_past( $request ) {
@@ -132,7 +133,7 @@ class Make_Sort_By extends WP_REST_Controller {
132 133
         $found_posts = $q->get_posts();
133 134
         wp_reset_postdata();
134 135
 
135
-        return new WP_REST_Response( $this->prepare_items_for_reponse($found_posts, false), 200 );
136
+        return new WP_REST_Response( $this->prepare_items_for_reponse($found_posts), 200 );
136 137
     }
137 138
 
138 139
     public function by_episode( $request ) {
@@ -140,18 +141,15 @@ class Make_Sort_By extends WP_REST_Controller {
140 141
         $found_posts = $q->get_posts();
141 142
         wp_reset_postdata();
142 143
 
143
-        return new WP_REST_Response( $this->prepare_items_for_reponse($found_posts, true), 200 );
144
+        return new WP_REST_Response([$q], 200 );
144 145
     }
145 146
 
146
-    public function prepare_items_for_reponse( $items, $p2p ) {
147
+    public function prepare_items_for_reponse( $items ) {
147 148
         $collection = [];
148 149
 
149 150
         forEach( $items as $item ) {
150 151
             $formatted = default_post_format( $item, false );
151 152
             $formatted[hero] = get_post_meta( $item->ID, 'hero_header', true );
152
-            if($p2p) {
153
-                $formatted[relatedto] = p2p_related_to( $item->ID );
154
-            } 
155 153
             array_push($collection, $formatted);
156 154
         }
157 155
 

Loading…
İptal
Kaydet