Viewing 3 replies - 1 through 3 (of 3 total)
  • I was able to fix this in BusinessHours.class.php

    Line 50 – public function shortcode( $atts, $content = null ) {

    Update this code to for the whole function and it should work for the shortcode

    public function shortcode( $atts, $content = null ) {

    $closed_text = business_hours()->settings()->get_default_closed_text();

    extract( shortcode_atts( array( ‘closed’ => $closed_text ), $atts ) );

    if ( empty( $content ) )
    return $content;

    $day = $this->get_day_using_timezone();
    $id = key( $day );

    $open = esc_html( business_hours()->settings()->get_open_hour( $id ) );
    $close = esc_html( business_hours()->settings()->get_close_hour( $id ) );
    $is_open_today = business_hours()->settings()->is_open( $id );
    $exceptions = BusinessHoursExceptions::instance()->get_exceptions_for_day_id( $id );
    if ( !empty( $exceptions ) ) {
    $open = $exceptions[‘open’];
    $close = $exceptions[‘close’];
    $is_open_today = !empty( $open ) && !empty( $close );
    $name = BusinessHoursExceptions::instance()->get_localized_date_for_day_id( $id );
    }
    if ( $is_open_today ) {
    $content = str_replace( “{{TodayOpen}}”, $open, $content );
    $content = str_replace( “{{TodayClose}}”, $close, $content );
    } else {
    $content = $closed;
    }

    return $content;
    }

    This fixed it. Thanks! I added your solution to the GitHub discussion: https://github.com/MZAWeb/business-hours-plugin/issues/31#issuecomment-138663938

    Thank you! I had the same problem… this worked perfectly!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Exceptions not displaying in Shortcode’ is closed to new replies.