From b0ea463d538e4403e06f679fcc74dd1306a99cf5 Mon Sep 17 00:00:00 2001 From: Vencislav Atanasov Date: Fri, 25 Oct 2024 00:09:41 +0300 Subject: [PATCH] Add countdown logic --- front-page.php | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/front-page.php b/front-page.php index 360fcc5..5530a25 100644 --- a/front-page.php +++ b/front-page.php @@ -4,9 +4,20 @@ '2024-11-02 10:00:00', +]; + $blog_slug = get_blog_slug(); -if ($blog_slug === '2024') { +if (array_key_exists($blog_slug, $eventStartTimes)) { + $now = new DateTimeImmutable('now'); + $eventStart = new DateTimeImmutable($eventStartTimes[$blog_slug] . ' Europe/Sofia'); + $interval = $now->diff($eventStart); +} + +if ($interval instanceof DateInterval && $interval->invert === 0) { ?>