Skip to content

Commit

Permalink
Merge pull request #242 from helsingborg-stad/fix/archive-get-date
Browse files Browse the repository at this point in the history
fix: Event date for occasion shows same date for all occasions
  • Loading branch information
NiclasNorin authored Jul 1, 2024
2 parents 255b120 + 16b3fc9 commit 032189a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions source/php/EventArchive.php
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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
*/
Expand Down

0 comments on commit 032189a

Please sign in to comment.