This article outlines some of the Groundplan helper functions and how you'd use them to improve the display logic in your theme.
These functions can help you:
- Reduce the number of clicks your patrons take to check out
- Get different title sizes to fit the context of your layout
- Convert dates to and from your local time
- Determine if a show is Upcoming, open, closed, unscheduled, or completely sold out
Function | Description | Arguments & Return Values |
---|---|---|
xdgp_load_all($args) | Loads all postmeta and post connection data (including performances) into $post variable or WP_Query Sample usage: $my_event = new WP_Query(array('p' => $post_id, 'post_type' => 'mc_event')); xdgp_load_all(array('query' => $my_event, 'connected_post_meta' => false, 'connections' => true, 'connection_meta' => true)); echo $my_event->byline; | $args (array) of arguments, including the following defaults: $defaults = array( 'query' => $wp_query, // the post query 'connections' => false, //include P2P connection, 'connection_meta' => false, //include P2P meta data for connections 'connected_post_meta' => false, //include post_meta for posts connected via P2P, 'mc_attachments' => true, // DEPRECATED 'post' => NULL, //object or post_id (object preferred, otherwise we requery), 'post_type' => NULL //failsafe for situations where the post type isn't being automatically found or needs to be overridden - can be array of types ); |
xdgp_get_event_status($event)
| Return an event status based on opening and closing dates and performance statuses | $event - Event Object. An event object that has already been loaded with fields and performances using xdgp_load_all(). return $status (string). unscheduled, upcoming, open, or closed |
xdgp_event_general_ticket_url($event)
| Find the most efficient available ticket url for the situation
| $event - Event Object. An event object that has already been loaded with fields and performances using xdgp_load_all(). return $ticket_url (url) most efficient available URL. |
xdgp_get_short_title($post)
| Return the shortest version of the title.
| $post - Post Object. An post object that has already been loaded with fields and performances using xdgp_load_all(). Filter - xdgp_calendar_display_event_short_title return $title (url) returns a short title |
xdgp_unset_groundplan_field($key, $template_name = null)
| Conditionally unset a default Groundplan to hide it from your site's user interface, or in the context of a specific Event template, e.g. Education Add-On Classes. | $key (string) ACF field Key (default field keys) $template_name (string, optional, default NULL): filename of the event template.
|
xdgp_calendar_ical_subscribe_link($event = false, $performance = false) SINCE 1.3.4 | Generates a subscribable iCal feed (compatible with iCal, Google, or Outlook using the webcal:// protocol) for either a full event or only one performance. In most cases, the subscribe link is an easier user interface for users who have set a default application for calendar feeds. | $event - Event Post Object, Event Post ID or array of event Post IDs $performance - Performance P2P object. If set, the feed will only be for one Performance / Event Instance Usage: xdgp_calendar_ical_subscribe_link(array(461.467,800,801)); xdgp_calendar_ical_subscribe_link($post->ID); |
xdgp_calendar_ical_link($event = false, $performance = false) | Generates a downloadable iCal feed (importable with iCal, Google, or Outlook) for either a full event or only one performance. | $event - Event Post Object
$performance - Performance P2P object. If set, the feed will only be for one Performance / Event Instance |
Education Add-On
Function | Description | Arguments & Return Values |
---|---|---|
xdgp_edu_class_general_ticket_url($class)
| Find the most efficient available ticket url for the situation, keeping in mind Education add-on conventions of one event Instance with a ticket URL for the entire class.
| $class - Class Object. An event object (with Class Template selected) that has already been loaded with fields and performances using xdgp_load_all(). return $ticket_url (url) most efficient available URL. |
xdgp_edu_class_instance_id($class)
| Find the appropriate Event Instance ID for single-event-instance-id Classes (that is Subscription Pakcages that have one Event Instance ID) | $class - Class Object. An event object (with Class Template selected) that has already been loaded with fields and performances using xdgp_load_all(). return $event_instance_id (url) most efficient available URL. |
PatronManager Add-On
Function | Description | Arguments & Return Values |
---|---|---|
xdgp_patronmanager_generate_member_login_url($ticket_url)
| Generate a formatted Patron Portal Member Login URL with Return Address URL | $ticket_url (url) URL to redirect to after log in. return $url (url) formatted URL which will redirect back to supplied URL after member login. |