diff --git a/includes/admin/post-types/meta-boxes/class-sp-meta-box-calendar-details.php b/includes/admin/post-types/meta-boxes/class-sp-meta-box-calendar-details.php index 170b18b2..71657549 100644 --- a/includes/admin/post-types/meta-boxes/class-sp-meta-box-calendar-details.php +++ b/includes/admin/post-types/meta-boxes/class-sp-meta-box-calendar-details.php @@ -28,6 +28,7 @@ class SP_Meta_Box_Calendar_Details { $date_past = get_post_meta( $post->ID, 'sp_date_past', true ); $date_future = get_post_meta( $post->ID, 'sp_date_future', true ); $date_relative = get_post_meta( $post->ID, 'sp_date_relative', true ); + $event_format = get_post_meta( $post->ID, 'sp_event_format', true ); $day = get_post_meta( $post->ID, 'sp_day', true ); $teams = get_post_meta( $post->ID, 'sp_team', false ); $table_id = get_post_meta( $post->ID, 'sp_table', true ); @@ -49,6 +50,15 @@ class SP_Meta_Box_Calendar_Details { sp_dropdown_statuses( $args ); ?>

+

+

+ +

@@ -139,6 +149,7 @@ class SP_Meta_Box_Calendar_Details { public static function save( $post_id, $post ) { update_post_meta( $post_id, 'sp_caption', esc_attr( sp_array_value( $_POST, 'sp_caption', 0 ) ) ); update_post_meta( $post_id, 'sp_status', sp_array_value( $_POST, 'sp_status', 0 ) ); + update_post_meta( $post_id, 'sp_event_format', sp_array_value( $_POST, 'sp_event_format', 0 ) ); update_post_meta( $post_id, 'sp_date', sp_array_value( $_POST, 'sp_date', 0 ) ); update_post_meta( $post_id, 'sp_date_from', sp_array_value( $_POST, 'sp_date_from', null ) ); update_post_meta( $post_id, 'sp_date_to', sp_array_value( $_POST, 'sp_date_to', null ) ); diff --git a/includes/class-sp-ajax.php b/includes/class-sp-ajax.php index 7521348a..f28bb5ae 100644 --- a/includes/class-sp-ajax.php +++ b/includes/class-sp-ajax.php @@ -423,6 +423,18 @@ class SP_AJAX { ?>

+

+ +

+

+ +

day ) $this->day = get_post_meta( $this->ID, 'sp_day', true ); + + if ( ! $this->event_format ) + $this->event_format = get_post_meta( $this->ID, 'sp_event_format', true ); if ( ! $this->number ) $this->number = -1; @@ -205,6 +211,13 @@ class SP_Calendar extends SP_Secondary_Post { ); endif; + if ( $this->event_format && 'all' != $this->event_format ): + $args['meta_query'][] = array( + 'key' => 'sp_format', + 'value' => $this->event_format, + ); + endif; + if ( $this->day ): $args['meta_query'][] = array( 'key' => 'sp_day', diff --git a/templates/event-blocks.php b/templates/event-blocks.php index e8d578f4..09488fba 100644 --- a/templates/event-blocks.php +++ b/templates/event-blocks.php @@ -14,6 +14,7 @@ $defaults = array( 'event' => null, 'title' => false, 'status' => 'default', + 'format' => 'all', 'date' => 'default', 'date_from' => 'default', 'date_to' => 'default', @@ -48,6 +49,8 @@ extract( $defaults, EXTR_SKIP ); $calendar = new SP_Calendar( $id ); if ( $status != 'default' ) $calendar->status = $status; +if ( $format != 'all' ) + $calendar->event_format = $format; if ( $date != 'default' ) $calendar->date = $date; if ( $date_from != 'default' ) diff --git a/templates/event-list.php b/templates/event-list.php index 454ca0f6..76adc6bb 100644 --- a/templates/event-list.php +++ b/templates/event-list.php @@ -13,6 +13,7 @@ $defaults = array( 'id' => null, 'title' => false, 'status' => 'default', + 'format' => 'all', 'date' => 'default', 'date_from' => 'default', 'date_to' => 'default', @@ -48,6 +49,8 @@ extract( $defaults, EXTR_SKIP ); $calendar = new SP_Calendar( $id ); if ( $status != 'default' ) $calendar->status = $status; +if ( $format != 'all' ) + $calendar->event_format = $format; if ( $date != 'default' ) $calendar->date = $date; if ( $date_from != 'default' )