To add a list of people assigned to an event to a page, first install the Groundplan Pro People Add-On.
Use this sample code as a starting point to create your cast list.
<?php
// Insert this code after the xdgp_load_all function on an event detail page
// To display a categorized list of People with headshots
//
// This layout uses Bootstrap CSS classes and may need to be adapted to suit your layout.
$people = $post->events_people;
if (!empty($people)) {
// Set this to true to show Union memberships and a legend for those memberships.
$show_union_legend = false;
// Organize Show Roles into categories, e.g. Cast, Crew.
// Configure Role Types in Groundplan >> Settings
$people_sorted = array();
$roles_to_skip = array('Roster');
foreach ($people as $person) {
if (isset($person->type) && in_array($person->type, $roles_to_skip))
continue;
$people_sorted[$person->type][] = $person;
}
?>
<section class="people">
<h3 class="people__title"><?php echo $people_title; ?></h3>
<?php
foreach ($people_sorted as $team => $grouped_people) { ?>
<div class="people__content">
<h4 class="people__type-title"><?php echo $team; ?></h4>
<div class="people-wrapper">
<?php
foreach ($grouped_people as $key => $person) {
$bio = $person->short_bio;
if (empty($bio))
$bio = xdgp_custom_excerpt(20, $person->long_bio);
$headshot = get_field('headshot', $person);
?>
<div class="person">
<div class="col-xs-12">
<?php
if (!empty($headshot)) {
// Uncomment links if you want to use a Person Detail layout (e.g. single-mc_person.php)
?>
<!-- <a href="<?php echo get_the_permalink($person->ID); ?>"> -->
<img src="<?php echo $headshot['url'] ; ?>" alt="<?php echo $person->post_title?>" />
<!-- </a> -->
<?php
} ?>
<p class="person__name">
<?php
/* <a href="<?php echo get_the_permalink($person->ID); ?>"> // Uncomment after Person Detail completed */
echo get_the_title($person->ID);
/* </a> */
echo (empty($person->is_actors_equity)) ? '' : ' <span class="associations actors-equity">*</span>';
echo (empty($person->is_usa)) ? '' : ' <span class="associations usa">†</span>';
echo (empty($person->is_sdc)) ? '' : ' <span class="associations sdc">‡</span>';
?>
</p>
<?php
if (is_singular('mc_event')) {
// Display the Event Role
echo (!empty($person->role)) ? '<p class="person__role">'.$person->role.'</p>': '';
} else {
// Display the company role
echo (!empty($person->role_title)) ? '<p class="person__role">'.$person->role_title.'</p>': '';
}
echo (!empty($person->email)) ? '<a class="person__email" href="mailto:'.$person->email.'">'.$person->email.'</a>' : '';
echo (!empty($bio)) ? '<div class="person__bio">'.apply_filters('the_content', $bio).'</div>' : '';
if (!$show_union_legend) {
$show_union_legend = ($person->is_actors_equity || $person->is_usa || $person->is_sdc);
}
?>
</div>
</div>
<?php
} ?>
</div>
</div>
<?php
} ?>
</section>
<?php
$legend = get_field('unions_legend', 'option');
if (!empty($legend) && $show_union_legend) { ?>
<div class="unions-legend">
<?php echo apply_filters('the_content', $legend); ?>
</div>
<?php
}