Skip to content

Instantly share code, notes, and snippets.

@joshfeck
Last active September 12, 2017 13:33
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 joshfeck/06f1ce1a3cc416ac3cf8 to your computer and use it in GitHub Desktop.
Save joshfeck/06f1ce1a3cc416ac3cf8 to your computer and use it in GitHub Desktop.
Add City and State information from registration to attendee list. From: https://eventespresso.com/topic/ee4-modify-list-attendees-shortcode-to-show-additional-attendee-info/
<?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 = '';
}
$states = EEM_State::instance()->get_all_states();
$state = isset( $states[ $contact->state_ID() ] ) ? $states[ $contact->state_ID() ]->get( 'STA_name' ) : $contact->state_ID();
$state = ! is_numeric( $state ) ? ', ' . $state : '';
$countries = EEM_Country::instance()->get_all_countries();
$country = isset( $countries[ $contact->country_ID() ] ) ? $countries[ $contact->country_ID() ]->get( 'CNT_name' ) : $contact->country_ID();
$country = ! empty( $country ) ? ', ' . $country : '';
?>
<?php do_action( 'AHEE__content-espresso_event_attendees__before', $contact, $show_gravatar ); ?>
<li><?php echo $gravatar . '&nbsp;' . $contact->full_name()
. ' &mdash; '
. $contact->city()
. $state
. $country; ?></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