Advertisement
Apina

modified espresso_list_of_event_dates

Nov 11th, 2014
312
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.31 KB | None | 0 0
  1. function espresso_list_of_event_dates( $EVT_ID = 0, $date_format = '', $time_format = '', $echo = TRUE, $show_expired = NULL, $format = TRUE, $add_breaks = TRUE ) {
  2. $date_format = ! empty( $date_format ) ? $date_format : get_option( 'date_format' );
  3. $time_format = ! empty( $time_format ) ? $time_format : get_option( 'time_format' );
  4. $date_format = apply_filters( 'FHEE__espresso_list_of_event_dates__date_format', $date_format );
  5. $time_format = apply_filters( 'FHEE__espresso_list_of_event_dates__time_format', $time_format );
  6. EE_Registry::instance()->load_helper( 'Event_View' );
  7. $datetimes = EEH_Event_View::get_all_date_obj( $EVT_ID, $show_expired );
  8. //d( $datetimes );
  9. if ( is_array( $datetimes ) && ! empty( $datetimes )) {
  10. global $post;
  11. $html = $format ? '<ul id="ee-event-datetimes-ul-' . $post->ID . '" class="ee-event-datetimes-ul">' : '';
  12. foreach ( $datetimes as $datetime ) {
  13. if ( $datetime instanceof EE_Datetime ) {
  14. if ( $format ) {
  15. $html .= '<li id="ee-event-datetimes-li-' . $datetime->ID() . '" class="ee-event-datetimes-li">';
  16. $datetime_name = $datetime->name();
  17. $html .= ! empty( $datetime_name ) ? '<strong>' . $datetime_name . '</strong>' : '';
  18. $html .= ! empty( $datetime_name ) && $add_breaks ? '<br />' : '';
  19. $html .= '<span class="dashicons dashicons-calendar"></span>' . $datetime->date_range( $date_format ) . '<br/>';
  20. //$html .= '<span class="dashicons dashicons-clock"></span>' . $datetime->time_range( $time_format );
  21. $datetime_description = $datetime->description();
  22. $html .= ! empty( $datetime_description ) && $add_breaks ? '<br />' : '';
  23. $html .= ! empty( $datetime_description ) ? ' - ' . $datetime_description : '';
  24. $html = apply_filters( 'FHEE__espresso_list_of_event_dates__datetime_html', $html, $datetime );
  25. $html .= '</li>';
  26. } else {
  27. $html .= $datetime;
  28. $html = apply_filters( 'FHEE__espresso_list_of_event_dates__datetime_html', $html, $datetime );
  29. }
  30. }
  31. }
  32. $html .= $format ? '</ul>' : '';
  33. } else {
  34. $html = $format ? '<p><span class="dashicons dashicons-marker pink-text"></span>' . __( 'There are no upcoming dates for this event.', 'event_espresso' ) . '</p><br/>' : '';
  35. }
  36. if ( $echo ) {
  37. echo $html;
  38. return '';
  39. }
  40. return $html;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement