Skip to content

Instantly share code, notes, and snippets.

@jo-snips
Created August 29, 2012 15:06
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jo-snips/3514001 to your computer and use it in GitHub Desktop.
Save jo-snips/3514001 to your computer and use it in GitHub Desktop.
The Events Calendar: Custom Query for Venue and Category
<ul>
<?php
global $post;
$events_query = tribe_get_events(
array(
'eventDisplay'=>'upcoming',
'posts_per_page'=>10,
'tax_query'=> array(
array(
'taxonomy' => 'tribe_events_cat',
'field' => 'slug',
'terms' => 'conferences'
)
),
'venue'=>412
)
);
foreach($events_query as $post) {
setup_postdata($post);
?>
<li>
<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
<span class="event-date"><a href="<?php the_permalink(); ?>"><?php echo tribe_get_start_date($post->ID, true, 'M j, Y'); ?></a></span>
<?php if ( has_post_thumbnail() ) { ?>
<div class="event-thumb">
<a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('thumbnail'); ?></a>
</div>
<div class="event-excerpt">
<?php the_excerpt(); ?>
</div>
<?php } else { ?>
<div class="event-content">
<?php the_content(); ?>
</div>
<?php } ?>
</li>
<?php } //endforeach ?>
<?php wp_reset_query(); ?>
</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment