public
Created

Patch against 2.0.10 to only display end time in The Events Calendar widget if end date is equal begin date. (German) example: 4. Februar 2013 19:00 – 22:00 instead of previously 4. Februar 2013 19:00 – 4. Februar 2013 22:00

  • Download Gist
noenddate.patch
Diff
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
--- the-events-calendar/public/template-tags/date.php 2012-12-26 13:57:11.000000000 +0100
+++ date.php 2012-12-26 18:32:36.000000000 +0100
@@ -57,7 +57,7 @@
* @todo support $postId for recurring events.
* @since 2.0
*/
- function tribe_get_end_date( $postId = null, $displayTime = 'true', $dateFormat = '' ) {
+ function tribe_get_end_date( $postId = null, $displayTime = 'true', $dateFormat = '', $displayDate = true ) {
$postId = TribeEvents::postIdHelper( $postId );
if (!$postId || ( function_exists('tribe_is_recurring_event') && tribe_is_recurring_event( $postId ) ) ) {
global $post;
@@ -77,7 +77,7 @@
return; // '—';
}
- return tribe_event_format_date($date, $displayTime, $dateFormat );
+ return tribe_event_format_date($date, $displayTime, $dateFormat, $displayDate );
}
/**
@@ -91,11 +91,12 @@
* @return string
* @since 2.0
*/
- function tribe_event_format_date($date, $displayTime = true, $dateFormat = '') {
+ function tribe_event_format_date($date, $displayTime = true, $dateFormat = '', $displayDate = true) {
$tribe_ecp = TribeEvents::instance();
- if( $dateFormat ) $format = $dateFormat;
- else $format = get_option( 'date_format', TribeDateUtils::DATEONLYFORMAT );
+ if( $displayDate )
+ if( $dateFormat ) $format = $dateFormat;
+ else $format = get_option( 'date_format', TribeDateUtils::DATEONLYFORMAT );
if ( $displayTime )
$format = $tribe_ecp->getTimeFormat( $format );
@@ -106,4 +107,4 @@
}
}
-?>
\ Kein Zeilenumbruch am Dateiende.
+?>
--- the-events-calendar/views/events-list-load-widget-display.php 2012-12-26 13:57:11.000000000 +0100
+++ events-list-load-widget-display.php 2012-12-26 18:48:37.493054525 +0100
@@ -44,8 +44,11 @@
$output = '';
echo tribe_get_start_date( $post->ID );
- if( tribe_is_multiday( $post->ID ) || !$event->AllDay ) {
- echo ' – <br/>'. tribe_get_end_date($post->ID);
+ if( tribe_is_multiday( $post->ID ) ) {
+ echo ' – <br/>'. tribe_get_end_date($post->ID, 'true', '', true);
+ }
+ elseif( !$event->AllDay ) {
+ echo ' – '. tribe_get_end_date($post->ID, 'true', '', false);
}
if( $event->AllDay ) {

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.