Advertisement
cosmocanuck

Event list

Oct 17th, 2015
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.50 KB | None | 0 0
  1. <?php
  2. /**
  3. * Event List Widget: Standard List
  4. *
  5. * The template is used for displaying the [eo_event] shortcode *unless* it is wrapped around a placeholder: e.g. [eo_event] {placeholder} [/eo_event].
  6. *
  7. * You can use this to edit how the output of the eo_event shortcode. See http://docs.wp-event-organiser.com/shortcodes/events-list
  8. * For the event list widget see widget-event-list.php
  9. *
  10. * For a list of available functions (outputting dates, venue details etc) see http://codex.wp-event-organiser.com/
  11. *
  12. ***************** NOTICE: *****************
  13. * Do not make changes to this file. Any changes made to this file
  14. * will be overwritten if the plug-in is updated.
  15. *
  16. * To overwrite this template with your own, make a copy of it (with the same name)
  17. * in your theme directory. See http://docs.wp-event-organiser.com/theme-integration for more information
  18. *
  19. * WordPress will automatically prioritise the template in your theme directory.
  20. ***************** NOTICE: *****************
  21. *
  22. * @package Event Organiser (plug-in)
  23. * @since 1.7
  24. */
  25. global $eo_event_loop,$eo_event_loop_args;
  26.  
  27. //Date % Time format for events
  28. $date_format = get_option('date_format');
  29. $time_format = get_option('time_format');
  30.  
  31. //The list ID / classes
  32. $id = ( $eo_event_loop_args['id'] ? 'id="'.$eo_event_loop_args['id'].'"' : '' );
  33. $classes = $eo_event_loop_args['class'];
  34.  
  35. ?>
  36.  
  37. <?php if( $eo_event_loop->have_posts() ): ?>
  38.  
  39. <ul <?php echo $id; ?> class="<?php echo esc_attr($classes);?>" >
  40.  
  41. <?php while( $eo_event_loop->have_posts() ): $eo_event_loop->the_post(); ?>
  42.  
  43. <?php
  44. //Generate HTML classes for this event
  45. $eo_event_classes = eo_get_event_classes();
  46.  
  47. //For non-all-day events, include time format
  48. $format = ( eo_is_all_day() ? $date_format : $date_format.' '.$time_format );
  49. ?>
  50.  
  51.  
  52.  
  53.  
  54.  
  55. <div class="<?php echo esc_attr(implode(' ',$eo_event_classes)); ?>" >
  56.  
  57.  
  58. <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" >
  59.  
  60. <?php
  61. $image_ids = get_post_meta($post->ID, 'poster');
  62.  
  63. foreach ($image_ids as $image)
  64. {
  65. $myupload = get_post($image);
  66. echo wp_get_attachment_image( $image, 'poster-thumb' );
  67. }
  68. ?>
  69.  
  70.  
  71. </a>
  72.  
  73. <h2><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" ><?php the_title(); ?></a></h2>
  74.  
  75.  
  76. <!-- List date/dates of film -->
  77.  
  78. <?php
  79. $occurrences = eo_get_the_occurrences_of( get_the_ID() );
  80. $movieDates = array();
  81. foreach( $occurrences as $occurrence_id => $occurrence ) {
  82. $movieDates[] = $occurrence['start']->format('l, F jS, Y \a\t g:i A');
  83. }
  84. echo '<strong>' . implode( ' / ', $movieDates ) . '</strong>';
  85. ?>
  86.  
  87.  
  88. <?php $now = new DateTime( 'now', eo_get_blog_timezone() );
  89. if( $now <= eo_get_schedule_last( DATETIMEOBJ ) ) {
  90. $readMoreText = '<strong>More info / Buy tickets</strong>';
  91. } else {
  92. $readMoreText = "More info";
  93. } ?>
  94.  
  95. <?php echo apply_filters('the_excerpt',get_the_excerpt().'&nbsp;<a href="'.get_permalink().'">' . $readMoreText . '</a>'); ?>
  96.  
  97.  
  98.  
  99. </div>
  100. <div class="clear" style="clear:both;"></div>
  101.  
  102.  
  103.  
  104.  
  105.  
  106. <?php endwhile; ?>
  107.  
  108. </ul>
  109.  
  110. <?php elseif( ! empty($eo_event_loop_args['no_events']) ): ?>
  111.  
  112. <ul id="<?php echo esc_attr($id);?>" class="<?php echo esc_attr($classes);?>" >
  113. <li class="eo-no-events" > <?php echo $eo_event_loop_args['no_events']; ?> </li>
  114. </ul>
  115.  
  116. <?php endif; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement