| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- <?php
- /**
- * Craft in America Custom Endpoints Plugin
- *
- * @since 1.0.0
- * @package cia_endpoints
- *
- * @wordpress-plugin
- * Plugin Name: Craft in America - API Endpoints
- * Plugin URI:
- * Description: Plugin that adds custom rest interface
- * Version: 1.0.0
- * Author: TOJ <john@yvvas.com>
- */
-
- // If this file is called directly, abort.
- if ( ! defined( 'WPINC' ) ) { die; }
-
- require_once('includes/class.make-endpoint.php');
- require_once('includes/class.make-sortby.php');
-
- /**
- * The standard wordpress post_types
- */
- add_action( 'rest_api_init', function () {
- $post_controller = new Make_Endpoint_For('post');
- $post_controller->register_custom_route('posts');
- });
- add_action( 'rest_api_init', function () {
- $page_controller = new Make_Endpoint_For('page');
- $page_controller->register_custom_route('pages');
- });
- add_action( 'rest_api_init', function () {
- $media_controller = new Make_Endpoint_For('media');
- $media_controller->register_custom_route('media');
- });
-
- /**
- * Craft in America custom post_types
- */
- add_action( 'rest_api_init', function () {
- $media_controller = new Make_Endpoint_For('episode');
- $media_controller->register_custom_route('episodes');
- });
- add_action( 'rest_api_init', function () {
- $media_controller = new Make_Endpoint_For('artist');
- $media_controller->register_custom_route('artists');
- });
-
- /**
- * Craft in America custom sort_types
- */
- add_action( 'rest_api_init', function () {
- $media_controller = new Make_Sort_By('by_alpha', 'artist');
- $media_controller->register_custom_route('sort/by-alpha');
- });
|