Skip to content

Instantly share code, notes, and snippets.

@joshfeck
Created September 12, 2017 17:59
Show Gist options
  • Save joshfeck/31d5ac0f3833b9820ccf947d01f243a3 to your computer and use it in GitHub Desktop.
Save joshfeck/31d5ac0f3833b9820ccf947d01f243a3 to your computer and use it in GitHub Desktop.
Example of a custom template for the [ESPRESSO_EVENT_ATTENDEES] shortcode. Event Espresso 4. You can add this template to your active WordPress theme.
<?php
/**
* Content Template for the [ESPRESSO_EVENT_ATTENDEES] shortcode
*
* @package Event Espresso
* @subpackage templates
* @since 4.6.29
* @author Darren Ethier
*
* Template Args that are available in this template
* @type EE_Attendee $contact
* @type bool $show_gravatar whether to show gravatar or not.
*/
if ( $show_gravatar ) {
$gravatar = get_avatar( $contact->email(),
(int) apply_filters( 'FHEE__loop-espresso_attendees-shortcode__template__avatar_size', 32 )
);
} else {
$gravatar = '';
}
$group_size = $contact->get_most_recent_registration_for_event( $event->get('EVT_ID'))->get('REG_group_size');
// if group size is 1, ditch the quantity display
$group_size = $group_size > 1 ? '(' . $group_size . ')' : '';
?>
<?php do_action( 'AHEE__content-espresso_event_attendees__before', $contact, $show_gravatar ); ?>
<li><?php echo $gravatar . '&nbsp;' . $contact->full_name() . ' ' . $group_size; ?></li>
<?php do_action( 'AHEE__content-espresso_event_attendees__after', $contact, $show_gravatar ); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment