Created
January 3, 2013 21:14
-
-
Save jo-snips/4447338 to your computer and use it in GitHub Desktop.
The Events Calendar - Get Events by Organizer
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 | |
$args = array( | |
'post_type' => array(TribeEvents::POSTTYPE), // use post_type IN () to avoid old tribe queries | |
'posts_per_page' => -1, | |
'order' => 'ASC', | |
'meta_query' => array( | |
array( | |
'key' => '_EventOrganizerID', | |
'value' => get_the_ID(), | |
'compare' => 'LIKE' | |
) | |
) | |
); | |
$events = new WP_Query( $args ); | |
if($events->have_posts()) : while ( $events->have_posts() ) : $events->the_post(); | |
?> | |
<h5 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h5> | |
<div class="entry-date"> | |
<span class="start"><?php echo tribe_get_start_date(); ?></span> | |
<?php if(tribe_is_multiday( get_the_ID() ) || tribe_get_all_day( get_the_ID() ) ) : ?> | |
<span class="divider"> - </span> | |
<span class="end"><?php echo tribe_get_end_date(); ?></span> | |
<?php endif; ?> | |
</div> | |
<div class="entry-content"> | |
<?php | |
if (has_excerpt()) | |
the_excerpt(); | |
else | |
the_content(); | |
?> | |
<a href="<?php the_permalink(); ?>" class="read-more">View Details »</a> | |
</div> | |
<?php | |
endwhile; | |
endif; | |
wp_reset_query(); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you for the gist. I used it as a starting point for a custom function to return a list of upcoming events for a specific author to display on their member pages. I altered the arguments to fit my needs. Thanks again!
After upgrading The Events Calendar to 3.4.1 (also PRO and Community 3.4), it threw two deprecated function warnings. You can find them in line 23 of your gist.