Add Layout Selection and modify the Event Filtering

This commit is contained in:
savvasha
2018-09-07 11:48:42 +03:00
parent cfc62c93c4
commit 013383fb2d
4 changed files with 78 additions and 8 deletions

View File

@@ -39,6 +39,12 @@ class SP_Calendar extends SP_Secondary_Post {
/** @var int The team ID. */
public $team;
/** @var array The teams IDs. */
public $teams_past;
/** @var string The event date. */
public $date_before;
/** @var int The player ID. */
public $player;
@@ -203,6 +209,23 @@ class SP_Calendar extends SP_Secondary_Post {
);
endif;
if ( $this->teams_past ):
foreach ( $this->teams_past as $team_past ):
$args['meta_query'][] = array(
'key' => 'sp_team',
'value' => $team_past,
'compare' => 'IN',
);
endforeach;
$args['date_query'] = array(
array(
'before' => $this->date_before,
'inclusive' => false,
)
);
endif;
if ( $this->player ):
$args['meta_query'][] = array(
'key' => 'sp_player',