Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save jessepearson/df5c3808f5880230af1888ce3c8eb990 to your computer and use it in GitHub Desktop.

Select an option

Save jessepearson/df5c3808f5880230af1888ce3c8eb990 to your computer and use it in GitHub Desktop.
Filter to tell Bookings to show the calendar month when the first block is available
<?php // Do not copy this line unless needed
/**
* As of Bookings 1.9.13 the current date will be shown in the calendar for performance reasons.
* To return to the previous functionality, a filter was put in place. The below function uses this
* filter to tell Bookings to show the calendar month when the first block is available.
* @param bool $move - This is here just to prevent errors
* @return bool false for first block's month, true for current month
*/
function move_bookings_calendar_to_first_available_block( $move ) {
return false;
}
add_filter( 'wc_bookings_calendar_default_to_current_date', 'move_bookings_calendar_to_first_available_block' );
@johndcoy-zz
Copy link
Copy Markdown

Should use following filter instead:

add_filter( 'wc_bookings_calendar_default_to_current_date', '__return_false' );

@AkremBelkahla
Copy link
Copy Markdown

Should use following filter instead:

add_filter( 'wc_bookings_calendar_default_to_current_date', '__return_false' );

@johndcoy

If i add this function, all dates are shown not bookable by default. I have to select a date to correct that.
On page load :
annotation
After date selection
annotation
Any idea why and how to fix it ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment