diff --git a/includes/api/class-sp-rest-api.php b/includes/api/class-sp-rest-api.php index 034d6a53..88e51574 100644 --- a/includes/api/class-sp-rest-api.php +++ b/includes/api/class-sp-rest-api.php @@ -120,21 +120,37 @@ class SP_REST_API { ) ); - register_rest_field( 'sp_event', - 'format', - array( - 'get_callback' => 'SP_REST_API::get_post_data', - 'update_callback' => 'SP_REST_API::update_post_meta', - 'schema' => array( - 'description' => __( 'Format', 'sportspress' ), - 'type' => 'string', - 'context' => array( 'view', 'edit', 'embed' ), - 'arg_options' => array( - 'sanitize_callback' => 'sanitize_text_field', - ), - ), - ) - ); + register_rest_field( 'sp_event', + 'format', + array( + 'get_callback' => 'SP_REST_API::get_post_data', + 'update_callback' => 'SP_REST_API::update_post_meta', + 'schema' => array( + 'description' => __( 'Format', 'sportspress' ), + 'type' => 'string', + 'context' => array( 'view', 'edit', 'embed' ), + 'arg_options' => array( + 'sanitize_callback' => 'sanitize_text_field', + ), + ), + ) + ); + + register_rest_field( 'sp_event', + 'mode', + array( + 'get_callback' => 'SP_REST_API::get_post_data', + 'update_callback' => 'SP_REST_API::update_post_meta', + 'schema' => array( + 'description' => __( 'Mode', 'sportspress' ), + 'type' => 'string', + 'context' => array( 'view', 'edit', 'embed' ), + 'arg_options' => array( + 'sanitize_callback' => 'sanitize_text_field', + ), + ), + ) + ); register_rest_field( 'sp_event', 'day', diff --git a/includes/class-sp-event.php b/includes/class-sp-event.php index a155ae82..1dadf1eb 100644 --- a/includes/class-sp-event.php +++ b/includes/class-sp-event.php @@ -26,15 +26,20 @@ class SP_Event extends SP_Custom_Post{ return $post_status; } - public function format() { - $format = get_post_meta( $this->ID, 'sp_format', true ); - return $format; - } + public function format() { + $format = get_post_meta( $this->ID, 'sp_format', true ); + return $format; + } - public function day() { - $day = get_post_meta( $this->ID, 'sp_day', true ); - return $day; - } + public function day() { + $day = get_post_meta( $this->ID, 'sp_day', true ); + return $day; + } + + public function mode() { + $mode = get_post_meta( $this->ID, 'sp_mode', true ); + return $mode; + } public function minutes() { $minutes = get_post_meta( $this->ID, 'sp_minutes', true );