Last active
December 27, 2015 15:29
-
-
Save joshfeck/7348467 to your computer and use it in GitHub Desktop.
Add a waitlist event post link to an event custom post type. Requires Event Espresso 3.x. Add to single-espresso_event.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // get the waitlist event data for this event | |
| $cpt_event = $wpdb->get_row("SELECT * FROM " . EVENTS_DETAIL_TABLE . " WHERE id='" . $event_id . "'"); | |
| $event_attendees_max = $cpt_event->reg_limit; | |
| $num_attendees = get_number_of_attendees_reg_limit($event_id, 'num_attendees'); //Get the number of attendees | |
| $allow_overflow = $cpt_event->allow_overflow; | |
| $overflow_event_id = $cpt_event->overflow_event_id; | |
| // get the overflow event's post ID | |
| $waitlist_post = $wpdb->get_var("SELECT post_id FROM " . EVENTS_DETAIL_TABLE . " WHERE id='" . $overflow_event_id . "'"); | |
| // check for a full event and for a waitlist event | |
| if (($num_attendees >= $event_attendees_max) && $allow_overflow == 'Y' && $overflow_event_id != 0) { | |
| // build the link to the waitlist event's post ?> | |
| <p><a href="<?php echo post_permalink($waitlist_post); ?>">Join Waiting List</a></p> | |
| <?php | |
| } | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment