We'll create fresh WordPress site with Multi-day Booking Calendar installed. You have 20 minutes to test the plugin after that site we'll be deleted.
This plugin allows you to link an existing form with a reservation calendar that allows multiple day and time selections.
The administration screen is a simple configuration screen that can be used to set business days, business hours, and reserved dates and times, and can issue embedded shortcodes.
Since the form itself does not provide any functionality, it can be linked directly to existing forms.
The simplicity and lack of extra features makes it easy to get started without confusion.
It can be used for car rental reservations, lodging reservations, event reservations, seminar reservations, meeting room reservations, lesson reservations, etc.
このプラグインは複数日の選択・時間の選択ができる予約カレンダーを既存のフォームに連携させることができます。
管理画面はシンプルな設定画面で営業日や営業時間、予約済みの日時などの設定ができ、埋め込みショートコードの発行が可能です。
フォーム自体の機能は提供しないため、既存のフォームにそのまま連携させることができます。
シンプルで余計な機能がないので混乱せずに簡単に始めることができます。
レンタカー予約、宿泊予約、イベント予約、セミナー予約、会議室予約、レッスン予約など様々な用途でご利用いただけます。
How to Use
Shortcode Settings
[multi-day-booking-calendar id='' start-name='' end-name='' start-time-name='' end-time-name='' mode='static']
API
By the time the form is submitted, the reservation may have been available or changed.
The plugin does not provide form functionality, so to find out exactly what is happening, please hit the API provided by the plugin before submitting the form.
フォームを送信するまでに、予約が可能か変更されている可能性があります。
当プラグインではフォーム機能は提供していないため、厳密に調べるためには、フォーム送信前に当プラグインが提供しているAPIを叩いてください。
Example for Contact Form 7
Please insert the ID of the registered calendar in the form content.
フォーム内容に下記のように登録カレンダーのIDを仕込んでください。
[hidden mdbc-id "2115"]
add_filter('wpcf7_validate', array($this, 'custom_wpcf7_validate'), 11, 2);
function custom_wpcf7_validate($result, $tags)
{
$mdbc_id = null;
foreach ($tags as $tag) {
$name = $tag['name'];
switch ($name) {
case 'start-day': //input tag name
$start_date = Date('Y-m-d', strtotime($_POST[$name]));
break;
case 'start-time': //input tag name
$start_time = $_POST[$name] ? $_POST[$name] : "00:00";
break;
case 'end-day': //input tag name
$end_date = Date('Y-m-d', strtotime($_POST[$name]));
break;
case 'end-time': //input tag name
$end_time = $_POST[$name] ? $_POST[$name] : "00:00";
break;
case 'mdbc-id': //ID of registered calendar
$mdbc_id = $_POST[$name];
default:
break;
}
}
if ($mdbc_id) {
$request = WP_REST_Request::from_url(home_url('/?rest_route=/mdbc/v1/check_reserve'));
$request->set_method('POST');
$request->set_param("postid", $mdbc_id);
$request->set_param("start", $start_date . " " . $start_time);
$request->set_param("end", $end_date . " " . $end_time);
$response = rest_do_request($request);
if ($response->is_error()) {
$result->invalidate("start-day", 'You cannot make reservations during that specified time period.');//Output error.
} else {
$data = $response->get_data();
if (!$data["can_reserve"])
$result->invalidate("start-day", 'You cannot make reservations during that specified time period.');//Output error.
}
}
return $result;
}