gpb_block_size

  1. Description
  2. Usage
  3. Parameters
  4. Examples
    1. 60-minute blocks on Fridays for specific service
    2. 30-minute blocks during a specific date range
  5. Since

Description

Filter the block size for a specific date. This filter allows for dynamically adjusting the time slot block size based on the date.

Usage

Applied globally

add_filter( 'gpb_block_size', 'my_custom_function' );

Parameters

$block_size int

The block size in minutes.

$date string

The date (Y-m-d format).

$service Service

The service object.

Examples

60-minute blocks on Fridays for specific service

add_filter( 'gpb_block_size', function( $block_size, $date, $service ) {
    if ( $service->get_id() === 123 && date( 'N', strtotime( $date ) ) === '5' ) {
        return 60;
    }
    return $block_size;
}, 10, 3 );

30-minute blocks during a specific date range

add_filter( 'gpb_block_size', function( $block_size, $date, $service ) {
    if ( $date >= '2025-06-01' && $date <= '2025-08-31' ) {
        return 30;
    }
    return $block_size;
}, 10, 3 );

Since

  • 1.0-beta-2.2 Hook added.