Simplify fix for events other than publish and future being queried in calendar
This commit is contained in:
@@ -154,7 +154,6 @@ class SP_Calendar extends SP_Secondary_Post {
|
|||||||
'posts_per_page' => $this->number,
|
'posts_per_page' => $this->number,
|
||||||
'orderby' => $this->orderby,
|
'orderby' => $this->orderby,
|
||||||
'order' => $this->order,
|
'order' => $this->order,
|
||||||
'post_status' => $this->status,
|
|
||||||
'meta_query' => array(
|
'meta_query' => array(
|
||||||
'relation' => 'AND'
|
'relation' => 'AND'
|
||||||
),
|
),
|
||||||
@@ -416,6 +415,7 @@ class SP_Calendar extends SP_Secondary_Post {
|
|||||||
|
|
||||||
$events = array_merge_recursive( $results, $fixtures );
|
$events = array_merge_recursive( $results, $fixtures );
|
||||||
} else {
|
} else {
|
||||||
|
$args['post_status'] = $this->status == 'any' ? array('publish', 'future') : explode ( ',', $this->status );
|
||||||
$events = get_posts( $args );
|
$events = get_posts( $args );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -653,8 +653,7 @@ if ( !function_exists( 'sp_dropdown_statuses' ) ) {
|
|||||||
$statuses = apply_filters( 'sportspress_statuses', array(
|
$statuses = apply_filters( 'sportspress_statuses', array(
|
||||||
'any' => __( 'All', 'sportspress' ),
|
'any' => __( 'All', 'sportspress' ),
|
||||||
'publish' => __( 'Published', 'sportspress' ),
|
'publish' => __( 'Published', 'sportspress' ),
|
||||||
'future' => __( 'Scheduled', 'sportspress' ),
|
'future' => __( 'Scheduled', 'sportspress' )
|
||||||
'publish,future' => __( 'Published + Scheduled', 'sportspress' )
|
|
||||||
));
|
));
|
||||||
|
|
||||||
foreach ( $statuses as $value => $label ):
|
foreach ( $statuses as $value => $label ):
|
||||||
|
|||||||
@@ -49,8 +49,7 @@ $defaults = array(
|
|||||||
extract( $defaults, EXTR_SKIP );
|
extract( $defaults, EXTR_SKIP );
|
||||||
|
|
||||||
$calendar = new SP_Calendar( $id );
|
$calendar = new SP_Calendar( $id );
|
||||||
$status = explode ( ',', $status );
|
if ( $status != 'default' )
|
||||||
if ( $status[0] != 'default' )
|
|
||||||
$calendar->status = $status;
|
$calendar->status = $status;
|
||||||
if ( $format != 'default' )
|
if ( $format != 'default' )
|
||||||
$calendar->event_format = $format;
|
$calendar->event_format = $format;
|
||||||
|
|||||||
Reference in New Issue
Block a user