Looking for meta key RSVP start date
-
I would like to show visitors that the subscription for an event is not open when the start date for RSVP is in the future. Current;y I’m using this php:
function get_rsvp_start_date($event_id) {
// Haal de beginverkoopdatum van het ticket op
$ticket_sales_start_date = get_post_meta($event_id, '_EventTicketStartDate', true);
if (!$ticket_sales_start_date) {
// Als de beginverkoopdatum van het ticket niet is ingesteld, geef een melding
return '<p style="color: red; font-weight: bold;">?? Geen beginverkoopdatum voor het ticket gevonden.</p>';
}
// Vergelijk de huidige datum met de beginverkoopdatum
$current_date = current_time('Y-m-d H:i:s');
$ticket_sales_start_date_timestamp = strtotime($ticket_sales_start_date);
$current_date_timestamp = strtotime($current_date);
// Als de huidige datum vóór de beginverkoopdatum is
if ($current_date_timestamp < $ticket_sales_start_date_timestamp) {
return '<p style="color: red; font-weight: bold;">?? Registration is not yet open. Start sale date: ' . esc_html($ticket_sales_start_date) . '</p>';
}
// Als de inschrijving is geopend, geef een succesbericht
return '<p style="color: green; font-weight: bold;">? RSVP is open!</p>';
}
// Shortcode om de RSVP startdatum te tonen
add_shortcode('rsvp_startdatum', function() {
$event_id = get_the_ID();
return get_rsvp_start_date($event_id);
});With this I get the message that the registration in not yet open.
I guess I don’t have the correct meta key.
Any help highly appreciated.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- You must be logged in to reply to this topic.