Advertisement
eventsmanager

Events List Group by Category

Sep 25th, 2013
1,999
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. /*
  2. this snippet will create a new shortcode [category_events_list_group]
  3.  
  4. Sample output:
  5.  
  6. Music
  7.  
  8. Sept 2013
  9.  
  10. Jazz Only Night - 2013/10/15 - 2013/10/16
  11. Rock n Roll 70's - 2013/10/18 - 2013/10/18
  12.  
  13. */
  14. function em_events_list_by_category(){
  15.  
  16. $EM_Categories = EM_Categories::get( array( 'exclude' => array(1,2,3) ) );
  17.  
  18. foreach( $EM_Categories as $EM_Category ){
  19.  
  20. echo "<h2>".$EM_Category->name."</h2>";
  21. echo do_shortcode('[events_list_grouped mode="monthly" category="'.$EM_Category->term_id.'"]');
  22.  
  23. }
  24.  
  25. }
  26. add_shortcode('category_events_list_group', 'em_events_list_by_category');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement