Browse Source

:recycle: shuffling imports

tags/0.9.0
J 4 years ago
parent
commit
4f2bf9377a

+ 11
- 1
plugins/cia-endpoints/cia-end-points.php View File

@@ -44,7 +44,7 @@ add_action( 'rest_api_init', function () {
44 44
     /**
45 45
      * Craft in America custom sort_types
46 46
      */
47
-    $artist_sorts = ['by_alpha', 'by_material'];
47
+    $artist_sorts = ['by_alpha', 'by_material', 'by_episode'];
48 48
     foreach ($artist_sorts as $sort) {
49 49
         $unsnaked = _unsnake($sort);
50 50
         $sort_controller = new Make_Sort_By('artist', $sort);
@@ -60,6 +60,16 @@ add_action( 'rest_api_init', function () {
60 60
             $sort_controller->register_custom_route("$date_type/$unsnaked");
61 61
         }
62 62
     }
63
+    
64
+    $episode_sorts = ['by_episode'];
65
+    $episode_types = ['artist','exhibition', 'event'];
66
+    foreach ($episode_sorts as $sort) {
67
+        $unsnaked = _unsnake($sort);
68
+        foreach ($episode_types as $episode_type) {
69
+            $sort_controller = new Make_Sort_By($episode_type, $sort);
70
+            $sort_controller->register_custom_route("$episode_type/$unsnaked");
71
+        }
72
+    }
63 73
 });
64 74
 
65 75
 /**

+ 1
- 2
plugins/cia-endpoints/includes/class.make-endpoint.php View File

@@ -1,8 +1,7 @@
1 1
 <?php
2
-include('settings.php');
2
+include('formats.php');
3 3
 include('reformat-blocks.php');
4 4
 include('related-items.php');
5
-include('formats.php');
6 5
 
7 6
 class Make_Endpoint_For extends WP_REST_Controller {
8 7
     private $post_type;

+ 0
- 2
plugins/cia-endpoints/includes/class.make-sortby.php View File

@@ -1,5 +1,4 @@
1 1
 <?php
2
-include('related-items.php');
3 2
 
4 3
 class Make_Sort_By extends WP_REST_Controller {
5 4
     private $post_type;
@@ -138,7 +137,6 @@ class Make_Sort_By extends WP_REST_Controller {
138 137
 
139 138
     public function by_episode( $request ) {
140 139
         $q = new WP_Query($this->make_args($request, null));
141
-        // $args['max'] $q->max_num_pages;
142 140
         $found_posts = $q->get_posts();
143 141
         wp_reset_postdata();
144 142
 

+ 0
- 2
plugins/cia-endpoints/includes/related-items.php View File

@@ -1,7 +1,5 @@
1 1
 <?php
2 2
 
3
-include(formats.php);
4
-
5 3
 function grab_ids_related_to_and_from($id_to_remove, $p2p_res) {
6 4
     $related_to_ids = array_map(function($post) {
7 5
         return (int)$post->p2p_to;

Loading…
Cancel
Save