eventsmanager

custom full-calendar template

Apr 5th, 2013
419
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. /*
  3. * http://wordpress.org/extend/plugins/events-manager/
  4. *
  5. * Modified 30/03/13 by David Churchill
  6. * This changes the Full Calendar into a Monthly List of Events, with Next/Previous Month Links. Also excludes days with no events.
  7. * Replaced Tables with div/class and removed code the show empty dates
  8. *
  9. * Copy to YOURTHEMEFOLDER > plugins > events-manager > calendar-full.php
  10. *
  11. * Live example: http://corfe-castle.co.uk/events
  12. *
  13. *
  14. *
  15. * There are two variables made available to you:
  16. *
  17. * $calendar - contains an array of information regarding the calendar and is used to generate the content
  18. * $args - the arguments passed to EM_Calendar::output()
  19. *
  20. * Note that leaving the class names for the previous/next links will keep the AJAX navigation working.
  21. */
  22.  
  23. $cal_count = count($calendar['cells']); //to prevent an extra tr
  24. $col_count = $tot_count = 1; //this counts collumns in the $calendar_array['cells'] array
  25. $col_max = count($calendar['row_headers']); //each time this collumn number is reached, we create a new collumn, the number of cells should divide evenly by the number of row_headers
  26. ?>
  27. <div class="cal-list-month"><a class="em-calnav full-link em-calnav-prev" href="<?php echo $calendar['links']['previous_url']; ?>">&lt;&lt;</a> | <?php echo ucfirst(date_i18n('F Y', $calendar['month_start'])); ?> | <a class="em-calnav full-link em-calnav-next" href="<?php echo $calendar['links']['next_url']; ?>">&gt;&gt;</a></div>
  28.  
  29. <?php
  30. foreach($calendar['cells'] as $date => $cell_data ){
  31. $class = ( !empty($cell_data['events']) && count($cell_data['events']) > 0 ) ? 'eventful':'eventless';
  32. if(!empty($cell_data['type'])){
  33. $class .= "-".$cell_data['type'];
  34. }
  35. ?>
  36.  
  37. <?php if ( $class != 'eventful-post' ){ ?>
  38. <?php if ( $class != 'eventful-pre' ){ ?>
  39.  
  40. <?php if( !empty($cell_data['events']) && count($cell_data['events']) > 0 ): ?>
  41. <div class="cal-list-day">
  42. <h2 class="cal-list-date"><?php echo date('jS',$cell_data['date']); ?></h2>
  43. <?php
  44. $cell_events = array();
  45. if( get_option('dbem_display_calendar_events_limit') ){
  46. $count = 0;
  47. foreach($cell_data['events'] as $cell_event){
  48. $cell_events[] = $cell_event;
  49. $count++;
  50. if($count > get_option('dbem_display_calendar_events_limit')) break;
  51. }
  52. }else{
  53. $cell_events = $cell_data['events'];
  54. }
  55. ?>
  56. <?php echo EM_Events::output($cell_events,array('format'=>get_option('dbem_full_calendar_event_format'))); ?>
  57. <?php if( count($cell_events) > get_option('dbem_display_calendar_events_limit',3) && get_option('dbem_display_calendar_events_limit_msg') != '' ): ?>
  58. <a href="<?php echo esc_url($cell_data['link']); ?>"><?php echo get_option('dbem_display_calendar_events_limit_msg'); ?></a>
  59. <?php endif; ?>
  60. </div>
  61. <?php else:?>
  62. <?php endif; ?>
  63.  
  64. <?php } ?>
  65. <?php } ?>
  66.  
  67. <?php
  68. //create a new row once we reach the end of a table collumn
  69. $col_count= ($col_count == $col_max ) ? 1 : $col_count+1;
  70. echo ($col_count == 1 && $tot_count < $cal_count) ? '':'';
  71. $tot_count ++;
  72. }
  73. ?>
  74.  
  75. <div class="cal-list-month"><a class="em-calnav full-link em-calnav-prev" href="<?php echo $calendar['links']['previous_url']; ?>">&lt;&lt;</a> | <?php echo ucfirst(date_i18n('F Y', $calendar['month_start'])); ?> | <a class="em-calnav full-link em-calnav-next" href="<?php echo $calendar['links']['next_url']; ?>">&gt;&gt;</a></div>
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×