Posted: February 16, 2014 at 3:29 am
Hi, Is there a widget or add-on available that could display a number of days left until a specific event start daye? There is a good example on this website: http://www.toastmasters-d18.org/ I’d would like to do the same for one of the Event Espresso events defined on the Espresso Calendar. Thank you, Jake | |
Hey Jake, Best thing to do here is create a custom shortcode. I whipped this up, it’s VERY basic, but should give you an idea as to what can be achieved. And yes, I hardcoded the site URL for the registration URL, so that needs to be changed. [eecountdown event_id=”1″] function eecountdown($atts) { extract(shortcode_atts(array('event_id' => ''), $atts)); $event_id = "{$event_id}"; global $wpdb, $espresso_manager, $current_user, $org_options; $sql = "SELECT * FROM " . EVENTS_DETAIL_TABLE . " WHERE id = '$event_id'"; $event = $wpdb->get_row($sql); //uncomment below to see the $event array //echo "<pre>" . print_r($event, 1) . "</pre>"; $current_date = strtotime(date('Y-m-d')); $start_date = strtotime($event->start_date); $time_remaining = $start_date - $current_date; $time_remaining = floor($time_remaining/(60*60*24)); ?> <h2><?php echo $time_remaining; ?></h2> <p>Days remaining until</p> <p><?php echo $event->event_name; ?></p> <p><?php echo apply_filters('filter_hook_espresso_display_featured_image', $event_id, !empty($event_meta['event_thumbnail_url']) ? $event_meta['event_thumbnail_url'] : '');?></p> <p><?php echo espresso_format_content($event->event_desc); ?></p> <p><a href="http://www.XXXX.com/event-registration/?ee=<?php echo $event_id;?>">Register Now</a> <?php } add_shortcode('eecountdown','eecountdown');
| |
The support post ‘Number of days remaining until ….’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.