Last active
March 11, 2020 09:54
-
-
Save Pebblo/316da15cc653109fd94d3960fffe777f to your computer and use it in GitHub Desktop.
Example of how to output all upcoming events linked to a person.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Template file to add extra content to a single person display | |
* Note: To customize, just copy the template from /public/templates/* and put in your theme folder. | |
* @since 1.0.0 | |
* @package EE People Addon | |
* @subpackage template | |
* @author Darren Ethier | |
*/ | |
global $post; | |
$where = array( | |
'Person_Post.PER_ID' => $post->ID, | |
'Person_Post.OBJ_type' => 'Event', | |
'Datetime.DTT_EVT_end' => array('>=', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end')) | |
); | |
$events = EEM_Event::instance()->get_all( | |
array( | |
$where, | |
'order_by' => array('Datetime.DTT_EVT_start' => 'ASC') | |
) | |
); | |
?> | |
<div class="eea-people-addon-person-events-container"> | |
<?php if ($events) : ?> | |
<h3><?php _e('Events this person is involved with:', 'event_espresso'); ?></h3> | |
<div class="eea-people-addon-people-type-container"> | |
<ul class="eea-people-addon-event-list-ul"> | |
<?php foreach ($events as $event) : ?> | |
<li> | |
<a class="eea-people-addon-link-to-event" href="<?php echo get_permalink($event->ID()); ?>" title="<?php printf(__('Click here to view more info about %s', 'event_espresso'), $event->name()); ?>"><span class="eea-people-addon-event-name"><?php echo $event->name(); ?></span></a> | |
</li> | |
<?php endforeach; ?> | |
</ul> | |
</div> | |
<?php endif; ?> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment