|
|
@@ -25,28 +25,28 @@ add_action( 'rest_api_init', function () {
|
|
25
|
25
|
* The standard wordpress post_types
|
|
26
|
26
|
*/
|
|
27
|
27
|
$page_controller = new Make_Endpoint_For('page');
|
|
28
|
|
- $page_controller->register_custom_route('pages');
|
|
|
28
|
+ $page_controller->register_custom_route('page');
|
|
29
|
29
|
|
|
30
|
30
|
$media_controller = new Make_Endpoint_For('media');
|
|
31
|
31
|
$media_controller->register_custom_route('media');
|
|
32
|
32
|
|
|
33
|
33
|
$post_controller = new Make_Endpoint_For('post');
|
|
34
|
|
- $post_controller->register_custom_route('posts');
|
|
|
34
|
+ $post_controller->register_custom_route('post');
|
|
35
|
35
|
|
|
36
|
36
|
/**
|
|
37
|
37
|
* Craft in America custom post_types
|
|
38
|
38
|
*/
|
|
39
|
39
|
$episode_controller = new Make_Endpoint_For('episode');
|
|
40
|
|
- $episode_controller->register_custom_route('episodes');
|
|
|
40
|
+ $episode_controller->register_custom_route('episode');
|
|
41
|
41
|
|
|
42
|
42
|
$artist_controller = new Make_Endpoint_For('artist');
|
|
43
|
|
- $artist_controller->register_custom_route('artists');
|
|
|
43
|
+ $artist_controller->register_custom_route('artist');
|
|
44
|
44
|
|
|
45
|
45
|
$event_controller = new Make_Endpoint_For('event');
|
|
46
|
|
- $event_controller->register_custom_route('events');
|
|
|
46
|
+ $event_controller->register_custom_route('event');
|
|
47
|
47
|
|
|
48
|
48
|
$exhibition_controller = new Make_Endpoint_For('exhibition');
|
|
49
|
|
- $exhibition_controller->register_custom_route('exhibitions');
|
|
|
49
|
+ $exhibition_controller->register_custom_route('exhibition');
|
|
50
|
50
|
|
|
51
|
51
|
$sticky_controller = new Make_Sticky_Endpoint();
|
|
52
|
52
|
$sticky_controller->register_custom_route('sticky');
|
|
|
@@ -55,25 +55,25 @@ add_action( 'rest_api_init', function () {
|
|
55
|
55
|
* Craft in America custom sort_types
|
|
56
|
56
|
*/
|
|
57
|
57
|
$sort_controller = new Make_Sort_By('artist', 'by_alpha');
|
|
58
|
|
- $sort_controller->register_custom_route('artists/by-alpha');
|
|
|
58
|
+ $sort_controller->register_custom_route('artist/by-alpha');
|
|
59
|
59
|
$sort_controller = new Make_Sort_By('artist', 'by_material');
|
|
60
|
|
- $sort_controller->register_custom_route('artists/by-material');
|
|
|
60
|
+ $sort_controller->register_custom_route('artist/by-material');
|
|
61
|
61
|
$sort_controller = new Make_Sort_By('event', 'by_past');
|
|
62
|
|
- $sort_controller->register_custom_route('events/by-past');
|
|
|
62
|
+ $sort_controller->register_custom_route('event/by-past');
|
|
63
|
63
|
$sort_controller = new Make_Sort_By('exhibition', 'by_past');
|
|
64
|
|
- $sort_controller->register_custom_route('exhibitions/by-past');
|
|
|
64
|
+ $sort_controller->register_custom_route('exhibition/by-past');
|
|
65
|
65
|
$sort_controller = new Make_Sort_By('event', 'by_current');
|
|
66
|
|
- $sort_controller->register_custom_route('events/by-current');
|
|
|
66
|
+ $sort_controller->register_custom_route('event/by-current');
|
|
67
|
67
|
$sort_controller = new Make_Sort_By('exhibition', 'by_current');
|
|
68
|
|
- $sort_controller->register_custom_route('exhibitions/by-current');
|
|
|
68
|
+ $sort_controller->register_custom_route('exhibition/by-current');
|
|
69
|
69
|
$sort_controller = new Make_Sort_By('event', 'by_upcoming');
|
|
70
|
|
- $sort_controller->register_custom_route('events/by-upcoming');
|
|
|
70
|
+ $sort_controller->register_custom_route('event/by-upcoming');
|
|
71
|
71
|
$sort_controller = new Make_Sort_By('exhibition', 'by_upcoming');
|
|
72
|
|
- $sort_controller->register_custom_route('exhibitions/by-upcoming');
|
|
|
72
|
+ $sort_controller->register_custom_route('exhibition/by-upcoming');
|
|
73
|
73
|
$sort_controller = new Make_Sort_By('event', 'by_current_and_upcoming');
|
|
74
|
|
- $sort_controller->register_custom_route('events/by-current-and-upcoming');
|
|
|
74
|
+ $sort_controller->register_custom_route('event/by-current-and-upcoming');
|
|
75
|
75
|
$sort_controller = new Make_Sort_By('exhibition', 'by_current_and_upcoming');
|
|
76
|
|
- $sort_controller->register_custom_route('exhibitions/by-current-and-upcoming');
|
|
|
76
|
+ $sort_controller->register_custom_route('exhibition/by-current-and-upcoming');
|
|
77
|
77
|
});
|
|
78
|
78
|
|
|
79
|
79
|
/**
|
|
|
@@ -83,22 +83,22 @@ add_action( 'rest_api_init', function () {
|
|
83
|
83
|
*/
|
|
84
|
84
|
add_filter('wp_rest_cache/allowed_endpoints', function () {
|
|
85
|
85
|
// The standard wordpress post_types
|
|
86
|
|
- if ( !isset($allowed_endpoints['craft/v2']) || !in_array('posts', $allowed_endpoints['craft/v2']) )
|
|
87
|
|
- $allowed_endpoints['craft/v2'][] = 'posts';
|
|
88
|
|
- if ( !isset($allowed_endpoints['craft/v2']) || !in_array('pages', $allowed_endpoints['craft/v2']) )
|
|
89
|
|
- $allowed_endpoints['craft/v2'][] = 'pages';
|
|
|
86
|
+ if ( !isset($allowed_endpoints['craft/v2']) || !in_array('post', $allowed_endpoints['craft/v2']) )
|
|
|
87
|
+ $allowed_endpoints['craft/v2'][] = 'post';
|
|
|
88
|
+ if ( !isset($allowed_endpoints['craft/v2']) || !in_array('page', $allowed_endpoints['craft/v2']) )
|
|
|
89
|
+ $allowed_endpoints['craft/v2'][] = 'page';
|
|
90
|
90
|
if ( !isset($allowed_endpoints['craft/v2']) || !in_array('media', $allowed_endpoints['craft/v2']) )
|
|
91
|
91
|
$allowed_endpoints['craft/v2'][] = 'media';
|
|
92
|
92
|
|
|
93
|
93
|
// Craft in America custom post_types
|
|
94
|
|
- if ( !isset($allowed_endpoints['craft/v2']) || !in_array('episodes', $allowed_endpoints['craft/v2']) )
|
|
95
|
|
- $allowed_endpoints['craft/v2'][] = 'episodes';
|
|
96
|
|
- if ( !isset($allowed_endpoints['craft/v2']) || !in_array('events', $allowed_endpoints['craft/v2']) )
|
|
97
|
|
- $allowed_endpoints['craft/v2'][] = 'events';
|
|
98
|
|
- if ( !isset($allowed_endpoints['craft/v2']) || !in_array('exhibitions', $allowed_endpoints['craft/v2']) )
|
|
99
|
|
- $allowed_endpoints['craft/v2'][] = 'exhibitions';
|
|
100
|
|
- if ( !isset($allowed_endpoints['craft/v2']) || !in_array('artists', $allowed_endpoints['craft/v2']) )
|
|
101
|
|
- $allowed_endpoints['craft/v2'][] = 'artists';
|
|
|
94
|
+ if ( !isset($allowed_endpoints['craft/v2']) || !in_array('episode', $allowed_endpoints['craft/v2']) )
|
|
|
95
|
+ $allowed_endpoints['craft/v2'][] = 'episode';
|
|
|
96
|
+ if ( !isset($allowed_endpoints['craft/v2']) || !in_array('event', $allowed_endpoints['craft/v2']) )
|
|
|
97
|
+ $allowed_endpoints['craft/v2'][] = 'event';
|
|
|
98
|
+ if ( !isset($allowed_endpoints['craft/v2']) || !in_array('exhibition', $allowed_endpoints['craft/v2']) )
|
|
|
99
|
+ $allowed_endpoints['craft/v2'][] = 'exhibition';
|
|
|
100
|
+ if ( !isset($allowed_endpoints['craft/v2']) || !in_array('artist', $allowed_endpoints['craft/v2']) )
|
|
|
101
|
+ $allowed_endpoints['craft/v2'][] = 'artist';
|
|
102
|
102
|
|
|
103
|
103
|
return $allowed_endpoints;
|
|
104
|
104
|
}, 10, 1);
|