Skip to content
Docs
Get RestroPress

Filter

rpress_store_hours_for_date

Updated
On this page

Filters the open and close window resolved for a date.

Runs at the end of rpress_get_store_hours_for_date(). The value is an array with the keys open (time string), close (time string) and closed (bool). Change them to override the hours for specific dates. When $skip_holidays is true the caller wants the recurring weekly schedule only.

Parameters#

ParameterTypeDescription
$hoursarrayArray with the keys open, close and closed.
$datestringDate being resolved, formatted Y-m-d.
$skip_holidaysboolWhether holidays were ignored when resolving the hours.

Return value#

array. Array with the keys open, close and closed.

Example#

function my_short_hours_on_sundays( $hours, $date, $skip_holidays ) {
	if ( '7' === wp_date( 'N', strtotime( $date ) ) ) {
		$hours['open']  = '12:00pm';
		$hours['close'] = '8:00pm';
	}
	return $hours;
}
add_filter( 'rpress_store_hours_for_date', 'my_short_hours_on_sundays', 10, 3 );

Source#

Applied in:

  • includes/rp-store-hours-basic.php (line 112), in rpress_get_store_hours_for_date()

See also#

Was this page helpful?