Skip to content

Commit

Permalink
Merge pull request #33 from stopfstedt/multiple-times-a-day
Browse files Browse the repository at this point in the history
handles multiple opening hours per day.
  • Loading branch information
stopfstedt authored Mar 11, 2020
2 parents 7187a5c + 6eeaf82 commit 4aa8e93
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
14 changes: 8 additions & 6 deletions public/class-wplibcalhours-public.php
Original file line number Diff line number Diff line change
Expand Up @@ -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( '<br>', $hours_text );
}
}
$days[ $day_raw['date'] ] = $text;
Expand Down
4 changes: 4 additions & 0 deletions public/css/wplibcalhours-public.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,7 @@
.wplibcalhours .next {
float: right;
}

.wplibcalhours tbody td {
vertical-align: top;
}

0 comments on commit 4aa8e93

Please sign in to comment.