Advertisement
Guest User

Untitled

a guest
Mar 3rd, 2015
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. <?php
  2. wp_reset_query();
  3. $terms = get_the_terms(get_the_ID(), 'tribe_events_cat');
  4. $cats = array();
  5. if($terms) {
  6. foreach( $terms as $term ) {
  7. $cats[] = $term->slug;
  8. }
  9. }
  10. $catArray = implode( ',', $cats );
  11.  
  12. global $post;
  13. $all_events = tribe_get_events(
  14. array(
  15. 'eventDisplay'=>'upcoming',
  16. 'posts_per_page'=>5,
  17. 'tax_query'=> array(
  18. 'relation' => 'OR',
  19. array(
  20. 'taxonomy' => 'tribe_events_cat',
  21. 'field' => 'slug',
  22. 'terms' => array($catArray),
  23. )
  24. )
  25. )
  26. );
  27.  
  28. foreach($all_events as $post) {
  29. setup_postdata($post);
  30. ?>
  31.  
  32. <li>
  33.  
  34. <a class="white-font" href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
  35.  
  36. </li>
  37.  
  38. <?php } //endforeach ?>
  39. <?php wp_reset_query(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement