Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //If defined elsewere remove this. I usually place this at the top of the themes functions.php file.
- if (!defined('HOME_URL'))
- {
- define('HOME_URL', home_url());
- }
- //This function grabs dates for related recurrent events and lists their dates and a link to their registration pages
- //only if the event is_active and the event_status = A if for some reason you want all events set $only_active to false.
- function list_recurrent_event_dates($recurrent_id, $only_active = true) {
- global $wpdb;
- //Grab only the ID and start_date for all recurring events related to the event you're running this function in
- $SQL = "select id, start_date from " . EVENTS_DETAIL_TABLE . " where recurrence_id = $recurrent_id";
- if($only_active)
- {
- $SQL .= " AND is_active = 'Y' AND event_status = 'A'";
- }
- $recurrent_dates = $wpdb->get_results( $wpdb->prepare( $SQL, $event_id ));
- //List each recurrent event date and a link to that event if active and registration is open.
- foreach ( $recurrent_dates as $recurrence ) {
- $is_active = event_espresso_get_is_active($recurrence->id);
- if($is_active['status'] == 'REGISTRATION_OPEN')
- {
- $newStartDate = $recurrence->start_date;
- $newStartDate = explode("-", $newStartDate);
- $newStartDate = date("F j, Y", mktime(0,0,0,$newStartDate[1],$newStartDate[2],$newStartDate[0]));
- echo '<a href="' . HOME_URL . '/event-registration/?ee=' . $recurrence->id . '">' . $newStartDate . '</a>, ';
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement