Skip to content

Instantly share code, notes, and snippets.

@jo-snips
Created November 6, 2012 15:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jo-snips/4025547 to your computer and use it in GitHub Desktop.
Save jo-snips/4025547 to your computer and use it in GitHub Desktop.
The Events Calendar: Get Events by Event Category w/WP_Query
<?php
$args = array(
'post_status'=>'publish',
'post_type'=>array(TribeEvents::POSTTYPE),
'posts_per_page'=>100,
'tax_query' => array(
array(
'taxonomy' => TribeEvents::TAXONOMY,
'field' => 'slug',
'terms' => 'site-specific-groups',
'operator' => 'IN'
)
),
'orderby'=>'title',
'order'=>'ASC'
);
$get_posts = null;
$get_posts = new WP_Query();
$get_posts->query($args);
if($get_posts->have_posts()) : while($get_posts->have_posts()) : $get_posts->the_post(); ?>
<li>
<?php the_title(); ?>
</li>
<?php
endwhile;
endif;
wp_reset_query();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment