Skip to content

Instantly share code, notes, and snippets.

@spigotdesign
Last active December 19, 2015 15:49
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 spigotdesign/5979056 to your computer and use it in GitHub Desktop.
Save spigotdesign/5979056 to your computer and use it in GitHub Desktop.
Tribe event category query
<?php $terms = rwmb_meta( '', 'type=taxonomy&taxonomy=tribe_events_cat' ); ?>
<?php foreach ( $terms as $term ) { $ecat = $term->slug; $ename = $term->name; } ?>
<?php $efeed = new WP_Query( array(
'post_type' => 'tribe_events',
'tribe_events_cat' => $ecat,
'showposts' => 5,
));
?>
// Note: rmwb_meta is very similar to WP's get_post_meta
<?php $efeed = new WP_Query( array(
'post_type' => 'tribe_events',
'showposts' => 5,
'tax_query' => array(
array(
'taxonomy' => 'tribe_events_cat',
'field' => 'slug',
'terms' => $ecat,
)
)
));
?>
@spigotdesign
Copy link
Author

The issue was the query was not pulling in child categories in version 1. Version 2 does.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment