I’ve actually almost have it working, it’s just the day that i’m struggling with now. $newday outside of the shortcode is displaying fine, but when used in the shortcode, the entire shortcode stops working. Here is the code below:
<?php
global $wpdb;
$canUpdate = false;
$currentDay = date(“Y-m-d”);
$query = “SELECT event_name, event_start_date, event_start_time FROM wp_em_events WHERE event_start_date > ‘”.$currentDay.”‘ AND event_status = 1 ORDER BY event_start_date ASC LIMIT 1″;
$result = $wpdb->get_results($query);
if ($result) {
$canUpdate = true;
foreach($result as $row)
{
$nextEventName = $row->event_name;
$nextEventDate = $row->event_start_date;
$nextEventTime = $row->event_start_time;
$nextEventDateAr = explode(“-“, $nextEventDate);
$nextEventTimeAr = explode(“:”, $nextEventTime);
$nextEventYear = $nextEventDateAr[0];
$nextEventMonth = $nextEventDateAr[1];
$nextEventDay = $nextEventDateAr[2];
$nextEventHour = $nextEventTimeAr[0];
$nextEventMinutes = $nextEventTimeAr[1];
$nextEventSeconds = $nextEventTimeAr[2];
}
}
$mydate = strtotime(‘$nextEventDay’);
$newday = date(‘l’, $mydate);
echo $newday;
?>
[countdown
title=””
event=”<?= $nextEventName ?>”
date=”<?= $newday ?>”
hour=”<?= $nextEventHour ?>”
minutes=”<?= $nextEventMinutes ?>”
seconds=”<?= $nextEventSeconds ?>”
format=”DHMS”]