From 11077a3f4e0f0d18bb5c6b8ae88a803d74ee74a7 Mon Sep 17 00:00:00 2001 From: Stefan Topfstedt Date: Wed, 11 Mar 2020 15:53:41 -0700 Subject: [PATCH 1/2] handles multiple opening hours per day. --- public/class-wplibcalhours-public.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/public/class-wplibcalhours-public.php b/public/class-wplibcalhours-public.php index 14c7204..bd90395 100644 --- a/public/class-wplibcalhours-public.php +++ b/public/class-wplibcalhours-public.php @@ -247,12 +247,14 @@ protected function extract_hours( array $weeks_raw_data ) { $text = __( 'closed', 'wplibcalhours' ); break; default: - if ( array_key_exists( 'hours', $day_raw['times'] ) - && ! empty( $day_raw['times']['hours'] ) - && array_key_exists( 'from', $day_raw['times']['hours'][0] ) - && array_key_exists( 'to', $day_raw['times']['hours'][0] ) - ) { - $text = $day_raw['times']['hours'][0]['from'] . ' - ' . $day_raw['times']['hours'][0]['to']; + if ( array_key_exists( 'hours', $day_raw['times'] ) && ! empty( $day_raw['times']['hours'] )) { + $hours_text = []; + foreach( $day_raw['times']['hours'] as $hours ) { + if (array_key_exists( 'from', $hours ) && array_key_exists( 'to', $hours )) { + $hours_text[] = $hours['from'] . ' - ' . $hours['to']; + } + } + $text = implode( '
', $hours_text ); } } $days[ $day_raw['date'] ] = $text; From 6eeaf82c7b4ddd71f9d59a594bb340419bb1e2f3 Mon Sep 17 00:00:00 2001 From: Stefan Topfstedt Date: Wed, 11 Mar 2020 15:59:23 -0700 Subject: [PATCH 2/2] aligns table cell contents on top. --- public/css/wplibcalhours-public.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/public/css/wplibcalhours-public.css b/public/css/wplibcalhours-public.css index 4f91dcb..f9f09d7 100644 --- a/public/css/wplibcalhours-public.css +++ b/public/css/wplibcalhours-public.css @@ -13,3 +13,7 @@ .wplibcalhours .next { float: right; } + +.wplibcalhours tbody td { + vertical-align: top; +}