Advertisement
eventsmanager

custom events list

Jul 27th, 2013
996
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. /*
  2. * Paste in your theme functions.php
  3. */
  4. function em_mod_custom_events_list(){
  5. $events = EM_Events::get(array('scope'=>'future','limit'=>10));
  6. ?>
  7. <table>
  8. <tbody>
  9. <?php
  10. $start = false;
  11. $limit = 3;
  12. $count = 1;
  13. foreach( $events as $EM_Event ){
  14. if ( !empty($EM_Event->event_name) ){
  15. ?>
  16. <?php if ( !$start ) { ?>
  17. <tr>
  18. <?php $start = true; ?>
  19. <?php } ?>
  20. <td><?php echo $EM_Event->output("#_EVENTLINK"); ?></td>
  21. <?php
  22. if ( $count == $limit ){
  23. ?>
  24. </tr>
  25. <?php
  26. $start = false;
  27. $count = 1;
  28. }else{
  29. $count++;
  30. }
  31. ?>
  32. <?php
  33. }
  34. }
  35. ?>
  36. </tbody>
  37. </table>
  38. <?php
  39.  
  40. }
  41. add_shortcode('custom_events_list', 'em_mod_custom_events_list');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement