Browse Source

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

tags/0.9.0
J 4 years ago
parent
commit
83dc7d0ae4
1 changed files with 11 additions and 13 deletions
  1. 11
    13
      plugins/cia-endpoints/includes/class.make-sortby.php

+ 11
- 13
plugins/cia-endpoints/includes/class.make-sortby.php View File

36
         
36
         
37
         if($this->post_type == 'artist') {
37
         if($this->post_type == 'artist') {
38
             //  Default to all materials
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
             if ($params['materials']) {
41
             if ($params['materials']) {
42
                 $tax_id_array = explode( ',', $params['materials'] );
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
             // 7 paper
49
             // 7 paper
49
             // 8 wood
50
             // 8 wood
50
             $args['tax_query'] = array(
51
             $args['tax_query'] = array(
57
         }
58
         }
58
         
59
         
59
         if($params['episode']) {
60
         if($params['episode']) {
60
-            $args['by'] = $params['episode'];
61
+            $args['p2p'] = $params['episode'];
61
         }
62
         }
62
 
63
 
63
         return $args;
64
         return $args;
114
         $found_posts = $q->get_posts();
115
         $found_posts = $q->get_posts();
115
         wp_reset_postdata();
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
     public function by_past( $request ) {
121
     public function by_past( $request ) {
132
         $found_posts = $q->get_posts();
133
         $found_posts = $q->get_posts();
133
         wp_reset_postdata();
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
     public function by_episode( $request ) {
139
     public function by_episode( $request ) {
140
         $found_posts = $q->get_posts();
141
         $found_posts = $q->get_posts();
141
         wp_reset_postdata();
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
         $collection = [];
148
         $collection = [];
148
 
149
 
149
         forEach( $items as $item ) {
150
         forEach( $items as $item ) {
150
             $formatted = default_post_format( $item, false );
151
             $formatted = default_post_format( $item, false );
151
             $formatted[hero] = get_post_meta( $item->ID, 'hero_header', true );
152
             $formatted[hero] = get_post_meta( $item->ID, 'hero_header', true );
152
-            if($p2p) {
153
-                $formatted[relatedto] = p2p_related_to( $item->ID );
154
-            } 
155
             array_push($collection, $formatted);
153
             array_push($collection, $formatted);
156
         }
154
         }
157
 
155
 

Loading…
Cancel
Save