Advertisement
Guest User

Untitled

a guest
Sep 11th, 2019
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.69 KB | None | 0 0
  1. <?php
  2. // Options
  3. $date_format = get_option( 'date_format' );
  4. $time_format = get_option( 'time_format' );
  5. $temp_month = '';
  6. $reg_button_text = !isset($button_text) ? __('Register', 'event_espresso') : $button_text;
  7. $alt_button_text = !isset($alt_button_text) ? __('View Details', 'event_espresso') : $alt_button_text;//For alternate registration pages
  8.  
  9. if ( have_posts() ) :
  10. // allow other stuff
  11. do_action( 'AHEE__espresso_grid_template_template__before_loop' );
  12. ?>
  13. <div id="mainwrapper" class="espresso-grid">
  14. <?php
  15. // Start the Loop.
  16. while ( have_posts() ) : the_post();
  17. // Include the post TYPE-specific template for the content.
  18. global $post;
  19.  
  20. //Debug
  21. //d( $post );
  22.  
  23. //Create the event link
  24. $external_url = $post->EE_Event->external_url();
  25. $button_text = !empty($external_url) ? $alt_button_text : $reg_button_text;
  26. $registration_url = !empty($external_url) ? $post->EE_Event->external_url() : $post->EE_Event->get_permalink();
  27. $feature_image_url = $post->EE_Event->feature_image_url();
  28.  
  29. if(!isset($default_image) || $default_image == '') {
  30. $default_image = EE_GRID_TEMPLATE_URL .'/images/default.jpg';
  31. }
  32.  
  33. $image = !empty($feature_image_url) ? $feature_image_url : $default_image;
  34.  
  35. $datetimes = EEM_Datetime::instance()->get_datetimes_for_event_ordered_by_start_time( $post->ID, $show_expired, false, 1 );
  36.  
  37. $datetime = end( $datetimes );
  38. if ($datetime instanceof EE_Datetime) {
  39.  
  40. $startdate = date_i18n( $date_format . ' ' . $time_format, strtotime( $datetime->start_date_and_time('Y-m-d', 'H:i:s') ) );
  41. ?>
  42.  
  43.  
  44. <div id="event-id-<?php echo $post->ID; ?>" class="ee_grid_box_v2 item">
  45. <?php do_action( 'AHEE__espresso_grid_template_template__grid_item_start', $post ); ?>
  46. <div class="event-title title"><?php echo $post->post_title; ?></div>
  47. <img src="<?php echo $image; ?>" alt="<?php echo sprintf( esc_attr__( '%s Feature Image', 'event_espresso'), $post->post_title ); ?>" />
  48. <p class="start-date">
  49. <span class="event-start-date"><?php echo $start_date; ?></span>
  50. &nbsp;
  51. <span class="event-start-time"><?php echo $start_time; ?></span>
  52. </p>
  53. <p class="event-link"><?php echo '<a class="register-link button" id="a_register_link-' . $post->ID .'" href="' . $registration_url . '">' . $button_text . '</a>'; ?></p>
  54. <p><?php the_excerpt(); ?></p>
  55.  
  56. <?php do_action( 'AHEE__espresso_grid_template_template__grid_item_end', $post ); ?>
  57. </div>
  58. <?php
  59. }
  60. endwhile;
  61. echo '</div>';
  62. // allow moar other stuff
  63. do_action( 'AHEE__espresso_grid_template_template__after_loop' );
  64.  
  65. else :
  66. // If no content, include the "No posts found" template.
  67. espresso_get_template_part( 'content', 'none' );
  68.  
  69. endif;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement