| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- <?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('artist', 'by_alpha');
- $media_controller->register_custom_route('by-alpha');
- $media_controller = new Make_Sort_By('artist', 'by_material');
- $media_controller->register_custom_route('by-material');
- });
|