Add player parameter to event calendar shortcodes
This commit is contained in:
@@ -40,6 +40,9 @@ class SP_Calendar extends SP_Custom_Post {
|
|||||||
/** @var int The team ID. */
|
/** @var int The team ID. */
|
||||||
public $team;
|
public $team;
|
||||||
|
|
||||||
|
/** @var int The player ID. */
|
||||||
|
public $player;
|
||||||
|
|
||||||
/** @var int Number of events. */
|
/** @var int Number of events. */
|
||||||
public $number;
|
public $number;
|
||||||
|
|
||||||
@@ -97,6 +100,9 @@ class SP_Calendar extends SP_Custom_Post {
|
|||||||
'orderby' => 'date',
|
'orderby' => 'date',
|
||||||
'order' => $this->order,
|
'order' => $this->order,
|
||||||
'post_status' => $this->status,
|
'post_status' => $this->status,
|
||||||
|
'meta_query' => array(
|
||||||
|
'relation' => 'AND'
|
||||||
|
),
|
||||||
'tax_query' => array(
|
'tax_query' => array(
|
||||||
'relation' => 'AND'
|
'relation' => 'AND'
|
||||||
),
|
),
|
||||||
@@ -128,12 +134,18 @@ class SP_Calendar extends SP_Custom_Post {
|
|||||||
endif;
|
endif;
|
||||||
|
|
||||||
if ( $this->team ):
|
if ( $this->team ):
|
||||||
$args['meta_query'] = array(
|
$args['meta_query'][] = array(
|
||||||
array(
|
'key' => 'sp_team',
|
||||||
'key' => 'sp_team',
|
'value' => array( $this->team ),
|
||||||
'value' => array( $this->team ),
|
'compare' => 'IN',
|
||||||
'compare' => 'IN',
|
);
|
||||||
),
|
endif;
|
||||||
|
|
||||||
|
if ( $this->player ):
|
||||||
|
$args['meta_query'][] = array(
|
||||||
|
'key' => 'sp_player',
|
||||||
|
'value' => array( $this->player ),
|
||||||
|
'compare' => 'IN',
|
||||||
);
|
);
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ $defaults = array(
|
|||||||
'season' => null,
|
'season' => null,
|
||||||
'venue' => null,
|
'venue' => null,
|
||||||
'team' => null,
|
'team' => null,
|
||||||
|
'player' => null,
|
||||||
'number' => -1,
|
'number' => -1,
|
||||||
'show_team_logo' => get_option( 'sportspress_event_blocks_show_logos', 'yes' ) == 'yes' ? true : false,
|
'show_team_logo' => get_option( 'sportspress_event_blocks_show_logos', 'yes' ) == 'yes' ? true : false,
|
||||||
'link_teams' => get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false,
|
'link_teams' => get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false,
|
||||||
@@ -54,6 +55,8 @@ if ( $venue )
|
|||||||
$calendar->venue = $venue;
|
$calendar->venue = $venue;
|
||||||
if ( $team )
|
if ( $team )
|
||||||
$calendar->team = $team;
|
$calendar->team = $team;
|
||||||
|
if ( $player )
|
||||||
|
$calendar->player = $player;
|
||||||
if ( $order != 'default' )
|
if ( $order != 'default' )
|
||||||
$calendar->order = $order;
|
$calendar->order = $order;
|
||||||
$data = $calendar->data();
|
$data = $calendar->data();
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ $defaults = array(
|
|||||||
'season' => null,
|
'season' => null,
|
||||||
'venue' => null,
|
'venue' => null,
|
||||||
'team' => null,
|
'team' => null,
|
||||||
|
'player' => null,
|
||||||
'initial' => true,
|
'initial' => true,
|
||||||
'caption_tag' => 'h4',
|
'caption_tag' => 'h4',
|
||||||
'show_all_events_link' => false,
|
'show_all_events_link' => false,
|
||||||
@@ -45,6 +46,8 @@ if ( $venue )
|
|||||||
$calendar->venue = $venue;
|
$calendar->venue = $venue;
|
||||||
if ( $team )
|
if ( $team )
|
||||||
$calendar->team = $team;
|
$calendar->team = $team;
|
||||||
|
if ( $player )
|
||||||
|
$calendar->player = $player;
|
||||||
$events = $calendar->data();
|
$events = $calendar->data();
|
||||||
|
|
||||||
if ( empty( $events ) ) {
|
if ( empty( $events ) ) {
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ $defaults = array(
|
|||||||
'season' => null,
|
'season' => null,
|
||||||
'venue' => null,
|
'venue' => null,
|
||||||
'team' => null,
|
'team' => null,
|
||||||
|
'player' => null,
|
||||||
'number' => -1,
|
'number' => -1,
|
||||||
'show_team_logo' => get_option( 'sportspress_event_list_show_logos', 'no' ) == 'yes' ? true : false,
|
'show_team_logo' => get_option( 'sportspress_event_list_show_logos', 'no' ) == 'yes' ? true : false,
|
||||||
'link_events' => get_option( 'sportspress_link_events', 'yes' ) == 'yes' ? true : false,
|
'link_events' => get_option( 'sportspress_link_events', 'yes' ) == 'yes' ? true : false,
|
||||||
@@ -55,6 +56,8 @@ if ( $venue )
|
|||||||
$calendar->venue = $venue;
|
$calendar->venue = $venue;
|
||||||
if ( $team )
|
if ( $team )
|
||||||
$calendar->team = $team;
|
$calendar->team = $team;
|
||||||
|
if ( $player )
|
||||||
|
$calendar->player = $player;
|
||||||
if ( $order != 'default' )
|
if ( $order != 'default' )
|
||||||
$calendar->order = $order;
|
$calendar->order = $order;
|
||||||
$data = $calendar->data();
|
$data = $calendar->data();
|
||||||
|
|||||||
Reference in New Issue
Block a user