*/ // 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'); });