eventsmanager

Random Events List

Dec 24th, 2014
448
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. Display random events list using custom shortcode [similarevents]
  3. */
  4. function similar_events() {
  5. $replace = "";
  6. $temp = array();
  7.  
  8. $events = EM_Events::get(array('scope'=>'future'));
  9. foreach ( $events as $EM_Event ) {
  10. array_push($temp,'<h6>'.$EM_Event->output('#_EVENTLINK').'</h6>');
  11. }
  12. shuffle($temp);
  13. foreach ( $temp as $event ) {
  14. if ($limit < 4)$replace .= $event;
  15. $limit++;
  16. }
  17. return $replace;
  18. }
  19. add_shortcode( 'similarevents', 'similar_events' );
RAW Paste Data