Update dashboard JS and frontend class
This commit is contained in:
1 parent
48c7d23261
commit
2b1424d127
8 files changed
+245
-98
No files matched your search
@@ -145,9 +145,10 @@ class HSSM_REST_API {
|
||||
);
|
||||
|
||||
// Add date filtering if specified
|
||||
$date_meta_query = null;
|
||||
if ( $date ) {
|
||||
$target_date = $date . ' 23:59:59';
|
||||
$query_args['meta_query'] = array(
|
||||
$date_meta_query = array(
|
||||
'relation' => 'AND',
|
||||
array(
|
||||
'relation' => 'OR',
|
||||
@@ -184,18 +185,26 @@ class HSSM_REST_API {
|
||||
)
|
||||
)
|
||||
);
|
||||
$query_args['meta_query'] = $date_meta_query;
|
||||
}
|
||||
|
||||
// Handle status filtering
|
||||
// Handle status filtering without dropping an existing date window
|
||||
if ( $status === 'scheduled' ) {
|
||||
$current_time = current_time( 'mysql' );
|
||||
$query_args['meta_query'] = array(
|
||||
array(
|
||||
'key' => '_hssm_start_date',
|
||||
'value' => $current_time,
|
||||
'compare' => '>'
|
||||
)
|
||||
$scheduled_clause = array(
|
||||
'key' => '_hssm_start_date',
|
||||
'value' => current_time( 'mysql' ),
|
||||
'compare' => '>'
|
||||
);
|
||||
|
||||
if ( $date_meta_query ) {
|
||||
$query_args['meta_query'] = array(
|
||||
'relation' => 'AND',
|
||||
$date_meta_query,
|
||||
$scheduled_clause,
|
||||
);
|
||||
} else {
|
||||
$query_args['meta_query'] = array( $scheduled_clause );
|
||||
}
|
||||
} elseif ( $status === 'all' ) {
|
||||
$query_args['post_status'] = array( 'publish', 'future', 'draft' );
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user