diff options
Diffstat (limited to 'plugins/jetpack/extensions/blocks/business-hours/business-hours.php')
-rw-r--r-- | plugins/jetpack/extensions/blocks/business-hours/business-hours.php | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/plugins/jetpack/extensions/blocks/business-hours/business-hours.php b/plugins/jetpack/extensions/blocks/business-hours/business-hours.php index e8a5e261..d3afa01d 100644 --- a/plugins/jetpack/extensions/blocks/business-hours/business-hours.php +++ b/plugins/jetpack/extensions/blocks/business-hours/business-hours.php @@ -105,36 +105,39 @@ function jetpack_business_hours_render( $attributes ) { } foreach ( $attributes['days'] as $day ) { - $content .= '<dt class="' . esc_attr( $day['name'] ) . '">' . + $content .= '<div class="jetpack-business-hours__item"><dt class="' . esc_attr( $day['name'] ) . '">' . ucfirst( $wp_locale->get_weekday( array_search( $day['name'], $days, true ) ) ) . '</dt>'; $content .= '<dd class="' . esc_attr( $day['name'] ) . '">'; $days_hours = ''; - foreach ( $day['hours'] as $hour ) { + foreach ( $day['hours'] as $key => $hour ) { $opening = strtotime( $hour['opening'] ); $closing = strtotime( $hour['closing'] ); if ( ! $opening || ! $closing ) { continue; } $days_hours .= sprintf( - /* Translators: Business opening hours info. */ - _x( 'From %1$s to %2$s', 'from business opening hour to closing hour', 'jetpack' ), + '%1$s - %2$s', date( $time_format, $opening ), date( $time_format, $closing ) ); - $days_hours .= '<br />'; + if ( $key + 1 < count( $day['hours'] ) ) { + $days_hours .= ', '; + } } if ( empty( $days_hours ) ) { $days_hours = esc_html__( 'Closed', 'jetpack' ); } $content .= $days_hours; - $content .= '</dd>'; + $content .= '</dd></div>'; } $content .= '</dl>'; + Jetpack_Gutenberg::load_assets_as_required( 'business-hours' ); + /** * Allows folks to filter the HTML content for the Business Hours block * |