Skip to content

Instantly share code, notes, and snippets.

@cliffordp
Created September 12, 2016 16:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cliffordp/718af5da51046f60b92372d01804f433 to your computer and use it in GitHub Desktop.
Save cliffordp/718af5da51046f60b92372d01804f433 to your computer and use it in GitHub Desktop.
<?php
/**
* Renders the attendee list for an event
*
* @version 4.1
*
* from https://gist.github.com/cliffordp/718af5da51046f60b92372d01804f433
* Screenshot of example output: https://cl.ly/093h1G2A1m3H
* put this file here: /wp-content/themes/YOUR-CHILD-THEME/tribe-events/attendees-list.php
* @link https://theeventscalendar.com/knowledgebase/themers-guide/#tickets-plus
*
*/
?>
<div class='tribe-attendees-list-container'>
<h2 class="tribe-attendees-list-title"><?php esc_html_e( 'Who\'s Attending', 'event-tickets-plus' ) ?></h2>
<p><?php echo esc_html( sprintf( _n( 'One person is attending %2$s', '%d people are attending %s', $attendees_total, 'event-tickets-plus' ), $attendees_total, get_the_title( $event->ID ) ) ); ?></p>
<ul class='tribe-attendees-list'>
<?php foreach ( $attendees_list as $attendee_id => $avatar_html ) {
// include RSVP's Name
// reset
$name = '';
// $attendee_id is the Post ID for each tribe_rsvp_attendees post type post (only works for RSVP type tickets, not WooCommerce, EDD, etc)
// https://developer.wordpress.org/reference/functions/get_post_meta/
$name = get_post_meta( $attendee_id, '_tribe_rsvp_full_name', true );
$name = trim( $name );
?>
<li class='tribe-attendees-list-item'>
<?php echo $avatar_html;
if ( ! empty( $name ) ) {
printf( ' <span class="tribe-custom-attendee-name">%s</span>', $name );
}
?></li>
<?php } ?>
</ul>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment