| @@ -1,0 +1,26 @@ | ||
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * Rest API | |
| 4 | + * | |
| 5 | + * @package GamiPress\Rest_API | |
| 6 | + * @author GamiPress <[email protected]>, Ruben Garcia <[email protected]> | |
| 7 | + * @since 1.6.0 | |
| 8 | + */ | |
| 9 | +// Exit if accessed directly | |
| 10 | +if( !defined( 'ABSPATH' ) ) exit; | |
| 11 | + | |
| 12 | +require_once GAMIPRESS_DIR . 'includes/api/class-wp-rest-gamipress-posts-controller.php'; | |
| 13 | + | |
| 14 | +/** | |
| 15 | + * Register new Rest API routes | |
| 16 | + * | |
| 17 | + * @since 1.0.0 | |
| 18 | + */ | |
| 19 | +function gamipress_rest_api_init() { | |
| 20 | + | |
| 21 | + // Register the /wp/v2/gamipress-posts endpoint (used on blocks to get a multiple post types endpoint) | |
| 22 | + $controller = new WP_REST_GamiPress_Posts_Controller(); | |
| 23 | + $controller->register_routes(); | |
| 24 | + | |
| 25 | +} | |
| 26 | +add_action('rest_api_init', 'gamipress_rest_api_init'); | |