Use the sample code on this page as an example of how to include Groundplan fields in your theme.
Groundplan fields can be accessed using the get_field() or the_field() functions by referencing the appropriate field ID. They are also saved as Post Meta, and can be displayed using core WP functions like get_post_meta if you prefer.
Make a copy of your theme's single.php file and save it as single-mc_event.php in your theme folder.
Paste and adapt the following code to fit your design.
This code is only a typical approach to content on an event page. For additional fields, refer to the Customizing Event and Venue Fields article.
<?php /* single-mc_event.php * Template for displaying all single posts. */ ?> <!-- ENTER YOUR HEADER HTML HERE --> <?php // Load Performances into your $post object for displaying the single calendar if (function_exists('xdgp_load_all')) xdgp_load_all(array('connections' => true, 'connection_meta' => true, 'connected_post_meta' => false)); // Display the cover image for the Event $cover_image = get_field('cover_image'); // Example using srcset for responsive images. echo '<img class="img-responsive" src="'.$cover_image['url'].'" alt="" srcset="'.$cover_image['sizes']['medium'].' 300w, '.$cover_image['sizes']['large'].' 640w">'; ?> <!-- Event Title --> <h2 class="event__title"> <?php the_title(); ?> </h2> <!-- Byline --> <div class="event__byline"> <?php the_field('byline') ?> </div> <!-- Date Range --> <p class="event__dates"> <?php the_field('display_dates_long') ?> </p> <?php // Display "Buy Tickets" link if a URL is set and the show hasn't closed yet ($post->status) $post->ticket_url = get_field('ticket_url'); $post->status = xdgp_get_event_status($post); // Calculate a Postponed, Cancelled, Rescheduled, or Sold Out label for a buy tickets button depending on your event status. $event_object = new XDGPEvent($post->ID, $post, true); $sold_out_text = ($post->status == 'sold-out') ? $event_object->get_status_label() : ''; $post->sold_out_message = (!empty($post->sold_out_message)) ? 'Sold Out' : $sold_out_text; // Calculate the ideal general ticket url for single performance, closed, or multi-performance events // Returns false when the event is closed // Returns Performance Ticket URL when the event only has one performance // Otherwise defaults to the General Ticket URL set above from the field. $post->ticket_url = xdgp_event_general_ticket_url($post); // If Tickets are on sale: if (!empty($ticket_url) && $post->status != 'closed'): ?> <p><a class="btn btn-primary" href="<?php echo $ticket_url ?>">Buy tickets</a></p> <?php endif; // endif tickets are on sale. // Display Price range if a value is set // $post->price_range and other event fields is set by xdgp_load_all() echo (!empty($post->price_range)) ? '<p class="event__pricing">'.$post->price_range.'</p>' : ''; // Display Event notes, like Running time and Disclaimer, if values are set. echo (!empty($post->running_time)) ? '<p class="event__running-time">Running Time: '.$post->running_time.'</p>' : ''; echo (!empty($post->disclaimer)) ? '<p class="event__disclaimer">'.$post->disclaimer.'</p>' : ''; ?> <div class="event__description"> <?php the_field('long_desc') ?> </div> <?php if ($post->status != 'closed') { echo '<h3>Schedule</h3>'; // Display a "single" style calendar for only this show. // For full configuration options, refer to https://nickxd.atlassian.net/wiki/x/IYBpAg $sold_out_message = (!empty($post->sold_out_message)) ? $post->sold_out_message : 'Sold Out'; $args = array( 'format' => 'F Y', 'week_start' => 0, 'show_genre' => false, 'genre_taxonomy' => 'xdgp_genre', 'wrapper_class' => 'example-calendar-class', // Modify this class to set CSS styles for the calendar in your theme 'show_all' => true, // 'event_post' => false, 'type' => 'agenda', // 'single', 'all', or 'agenda' 'performances' => $post->performances, // 'pad' => false, // 'show_days' => false, 'buy_text' => 'Buy Tickets', 'fast_forward' => true, 'priority' => 'tickets', // can be 'tickets' or 'details' // 'perfs' => false, //override perfs array 'sold_out_message' => $sold_out_message, ); $calendar = new XDGPCalendar($args); echo $calendar->xdgp_display_calendar(); } ?> <!-- ENTER YOUR FOOTER HTML HERE -->