From e9b1d84c413700461a9759be294c706d01696a34 Mon Sep 17 00:00:00 2001 From: savvasha Date: Sun, 10 Dec 2017 21:09:51 +0200 Subject: [PATCH 1/8] Add event_id as an option to the template --- templates/event-blocks.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/templates/event-blocks.php b/templates/event-blocks.php index 2021d2a9..f727e190 100644 --- a/templates/event-blocks.php +++ b/templates/event-blocks.php @@ -11,6 +11,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly $defaults = array( 'id' => null, + 'event_id' => null, 'title' => false, 'status' => 'default', 'date' => 'default', @@ -58,6 +59,8 @@ if ( $date_future != 'default' ) $calendar->future = $date_future; if ( $date_relative != 'default' ) $calendar->relative = $date_relative; +if ( $event_id ) + $calendar->event_id = $event_id; if ( $league ) $calendar->league = $league; if ( $season ) @@ -175,4 +178,4 @@ if ( $title ) if ( $id && $show_all_events_link ) echo ''; ?> - \ No newline at end of file + From 4c43023175df1550008e98b9f975b866c0336c4b Mon Sep 17 00:00:00 2001 From: savvasha Date: Sun, 10 Dec 2017 21:12:14 +0200 Subject: [PATCH 2/8] Add event_id as a variable to Calendar Class --- includes/class-sp-calendar.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/includes/class-sp-calendar.php b/includes/class-sp-calendar.php index 26c3ae9f..cb49e953 100644 --- a/includes/class-sp-calendar.php +++ b/includes/class-sp-calendar.php @@ -45,6 +45,9 @@ class SP_Calendar extends SP_Secondary_Post { /** @var int Number of events. */ public $number; + + /** @var int The event ID. */ + public $event_id; /** * __construct function. @@ -277,6 +280,10 @@ class SP_Calendar extends SP_Secondary_Post { ), ); } + + if ( $this->event_id) { + $args['p'] = $this->event_id; + } if ( 'auto' === $this->date && 'any' === $this->status ) { $args['post_status'] = 'publish'; From 7d26c871e218daffcedba2b849386ced879dd349 Mon Sep 17 00:00:00 2001 From: savvasha Date: Sun, 10 Dec 2017 21:30:39 +0200 Subject: [PATCH 3/8] Add event_id to event-blocks shortcode --- includes/class-sp-ajax.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/includes/class-sp-ajax.php b/includes/class-sp-ajax.php index dbef2f57..fd34eafd 100644 --- a/includes/class-sp-ajax.php +++ b/includes/class-sp-ajax.php @@ -468,6 +468,12 @@ class SP_AJAX {

+

+ +

@@ -1037,7 +1037,7 @@ class SP_AJAX { args.show_all_events_link = $div.find('[name=show_all_events_link]:checked').length; } else if ( 'event_blocks' == type ) { args.title = $div.find('[name=title]').val(); - args.event_id = $div.find('[name=event_id]').val(); + args.event = $div.find('[name=event]').val(); args.team = $div.find('[name=team]').val(); args.league = $div.find('[name=league]').val(); args.season = $div.find('[name=season]').val(); diff --git a/includes/class-sp-calendar.php b/includes/class-sp-calendar.php index cb49e953..a4824e73 100644 --- a/includes/class-sp-calendar.php +++ b/includes/class-sp-calendar.php @@ -47,7 +47,7 @@ class SP_Calendar extends SP_Secondary_Post { public $number; /** @var int The event ID. */ - public $event_id; + public $event; /** * __construct function. @@ -281,8 +281,8 @@ class SP_Calendar extends SP_Secondary_Post { ); } - if ( $this->event_id) { - $args['p'] = $this->event_id; + if ( $this->event) { + $args['p'] = $this->event; } if ( 'auto' === $this->date && 'any' === $this->status ) { diff --git a/templates/event-blocks.php b/templates/event-blocks.php index f727e190..318e1624 100644 --- a/templates/event-blocks.php +++ b/templates/event-blocks.php @@ -11,7 +11,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly $defaults = array( 'id' => null, - 'event_id' => null, + 'event' => null, 'title' => false, 'status' => 'default', 'date' => 'default', @@ -59,8 +59,8 @@ if ( $date_future != 'default' ) $calendar->future = $date_future; if ( $date_relative != 'default' ) $calendar->relative = $date_relative; -if ( $event_id ) - $calendar->event_id = $event_id; +if ( $event ) + $calendar->event = $event; if ( $league ) $calendar->league = $league; if ( $season )