diff --git a/cmoa-event.php b/cmoa-event.php index 90f8ad0..76bdfe1 100644 --- a/cmoa-event.php +++ b/cmoa-event.php @@ -302,55 +302,65 @@ public function formatted_instances() { } /* - * display_dates + * custom_date * - * This function will conditionally render an html template based on event conditions + * This function will return a custom date format field * * @type function - * @date 11/09/16 - * @since 1.1.0 + * @date 07/17/20 + * @since 4.2.2 * - * @return html template string + * @return string */ + public function custom_date() { + return function_exists('get_field') ? get_field('date_display', $this->details->get('post_id')) : false; + } + /* - * custom_formatting + * custom_date * - * This function will return a custom format field + * This function will return a custom date format field * * @type function - * @date 11/12/19 - * @since 4.2.0 + * @date 07/17/20 + * @since 4.2.2 * * @return string */ - public function custom_formatting() { - return function_exists('get_field') ? get_field('date_display', $this->details->get('post_id')) : false; + public function custom_time() { + return function_exists('get_field') ? get_field('time_display', $this->details->get('post_id')) : false; } + /* + * display_dates + * + * This function will conditionally render an html template based on event conditions + * + * @type function + * @date 11/09/16 + * @since 1.1.0 + * + * @return html template string + */ + public function display_dates() { - if($this->custom_formatting()) { + if($this->custom_date()): $template = 'custom'; - } - elseif($this->has_end_date() && $this->recurrence() === 'CUSTOM') { + elseif($this->has_end_date() && $this->recurrence() === 'CUSTOM'): $template = 'date_range'; - } - elseif($this->recurrence() !== false && $this->recurrence() !== 'CUSTOM') { + elseif($this->recurrence() !== false && $this->recurrence() !== 'CUSTOM'): $template = 'recurring'; - } - elseif($this->details->get('recurrence_rules')) { + elseif($this->details->get('recurrence_rules')): $template = 'multi'; - } - elseif ($this->all_day() || $this->has_no_end_time()) { + elseif ($this->all_day() || $this->has_no_end_time()): $template = 'start_date'; - } - elseif ($this->details->get('start')->format('Ymd') != $this->details->get('end')->format('Ymd')) { + elseif ($this->details->get('start')->format('Ymd') != $this->details->get('end')->format('Ymd')): $template = 'mixed_range'; - } - else { + else: $template = 'single'; - } + endif; return $this->mustache->render("$template.html", $this); } diff --git a/composer.json b/composer.json index 952b594..bc36cee 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "cmoa/wp-museum-calendar", "description": "Bridge to WordPress calendar data", - "version": "4.2.1", + "version": "4.2.2", "keywords": ["wordpress", "plugin", "carneyplusco", "all-in-one-event-calendar"], "homepage": "https://carney.co", "license": "MIT", diff --git a/plugin.php b/plugin.php index d37c2f7..6ad7d2d 100644 --- a/plugin.php +++ b/plugin.php @@ -4,7 +4,7 @@ * Description: Bridge to WordPress calendar data * Author: Carney+Co. * Author URI: https://carney.co - * Version: 4.2.1 + * Version: 4.2.2 */ /** diff --git a/templates/custom.html b/templates/custom.html index f172bba..9b909ac 100644 --- a/templates/custom.html +++ b/templates/custom.html @@ -1,4 +1,9 @@ diff --git a/templates/date_range.html b/templates/date_range.html index f9dc4ca..a9e39a2 100644 --- a/templates/date_range.html +++ b/templates/date_range.html @@ -1,4 +1,9 @@ diff --git a/templates/mixed_range.html b/templates/mixed_range.html index c3e787b..8018c05 100644 --- a/templates/mixed_range.html +++ b/templates/mixed_range.html @@ -1,3 +1,6 @@ diff --git a/templates/multi.html b/templates/multi.html index 8bc7b1d..fa9c5c0 100644 --- a/templates/multi.html +++ b/templates/multi.html @@ -3,10 +3,15 @@ {{#formatted_instances}} {{day}}, {{year}} - {{^all_day}} - {{start_time}}{{^has_no_end_time}}–{{end_time}}{{/has_no_end_time}} - {{/all_day}} + {{^ custom_time}} + {{^ all_day}} + {{start_time}}{{^has_no_end_time}}–{{end_time}}{{/has_no_end_time}} + {{/ all_day}} + {{/ custom_time}}
{{/formatted_instances}} + {{# custom_time}} + {{{custom_time}}} + {{/ custom_time}}

diff --git a/templates/recurring.html b/templates/recurring.html index 38593ba..32cf475 100644 --- a/templates/recurring.html +++ b/templates/recurring.html @@ -1,6 +1,11 @@ diff --git a/templates/single.html b/templates/single.html index a4fdc55..b4dd34f 100644 --- a/templates/single.html +++ b/templates/single.html @@ -1,4 +1,9 @@ diff --git a/templates/start_date.html b/templates/start_date.html index 1dd7340..ef05806 100644 --- a/templates/start_date.html +++ b/templates/start_date.html @@ -1,6 +1,11 @@