Filter
rpress_reservation_slot_capacity
On this page
Filters the number of seats available in a reservation time slot.
Runs for every slot built by rpress_reservation_get_slots(). The default is the Seats per time slot setting. The remaining seats shown to guests are this value minus the covers already held by active reservations in that slot, so it can be used for per-day or per-time capacity.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$value | int | Default seats per slot. |
$ts | int | Slot start as a Unix timestamp. |
$date | string | Date being calculated (Y-m-d). |
Return value#
int. Seats available in this slot.
Example#
function my_reservation_slot_capacity( $capacity, $ts, $date ) {
// Fewer seats on Saturdays.
if ( 6 === (int) wp_date( 'N', $ts ) ) {
return 12;
}
return $capacity;
}
add_filter( 'rpress_reservation_slot_capacity', 'my_reservation_slot_capacity', 10, 3 );
Notes#
The first argument is the capacity value taken from the settings array. The result is cast to int.
Source#
Applied in:
includes/features/reservations/functions.php(line 254), inrpress_reservation_get_slots()
See also#
Was this page helpful?
