diff --git a/source/php/EventArchive.php b/source/php/EventArchive.php index b4313ea6..5108aa51 100644 --- a/source/php/EventArchive.php +++ b/source/php/EventArchive.php @@ -25,6 +25,7 @@ public function __construct() add_filter('Municipio/Archive/showFilter', [$this, 'showFilter'], 999); add_filter('Municipio/Archive/getTaxonomyFilters/taxonomies', [$this, 'taxonomyFilters'], 999, 2); + add_filter('Municipio/Controller/Archive/getDate', [$this, 'getDate'], 10, 2); } private function occasionsTableExist() { @@ -55,6 +56,16 @@ public function taxonomyFilters($taxonomies, $taxonomy) return $taxonomies; } + public function getDate($date, $post) + { + + if ($post->postType !== $this->eventPostType || empty($post->startDate)) { + return $date; + } + + return $post->startDate; + } + /** * Show event start & end date instead of publish date when calling "the_time()" within an event archive */