[WordPress] 外掛分享: Multi-day Booking Calendar

首頁外掛目錄 › Multi-day Booking Calendar
WordPress 外掛 Multi-day Booking Calendar 的封面圖片
⚠ 此外掛已下架 — 不再更新維護,建議勿安裝。
10+
安裝啟用
尚無評分
1339 天前
最後更新
問題解決
WordPress 4.9+ PHP 7.0+ v1.0.1 上架:2022-07-30

內容簡介

此外掛可以將現有表單連接到一個預約日曆,並允許多天和時間的選擇。
管理畫面是一個簡單的配置畫面,可用於設置工作日、工作時間和預約日期和時間,並可發佈嵌入式短代碼。
由於表單本身不提供任何功能,因此可以直接將其連接到現有的表單。
簡單而沒有額外功能的設計使得初學者容易上手,可用於汽車租賃預約、住宿預約、活動預約、研討會預約、會議室預約、課程預約等等。

使用方法

啟用插件後,打開日曆的通用設置頁面。通用設置頁面可用於設置假期、定期假期以及可以進行預約的時間段和時間。
日曆的新提交頁面允許對每個事件的日期和時間狀態進行管理。
短代碼在上面的頁面生成後,請將其插入含有輸入的表單提交,例如 Contact Form 7。有關短代碼的屬性,請參閱下面的「短碼設置」,僅顯示日曆的文章頁面將不包含輸入。在這種情況下,請勿輸入除 id 以外的屬性值。
前端顯示已註冊的日曆,選擇日期和時間將反映在輸入中。

短碼設置

[multi-day-booking-calendar id='' start-name='' end-name='' start-time-name='' end-time-name='' mode='static']

id
已註冊日曆的提交 ID。必填。
start-name
開始日期的 input tag 的 name 屬性。
start-time-name
開始時間的 input tag 的 name 屬性。
end-name
結束日期的 input tag 的 name 屬性。
end-time-name
結束時間的 input tag 的 name 屬性。
mode

外掛標籤

開發者團隊

⬇ 下載最新版 (v1.0.1) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「Multi-day Booking Calendar」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

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

After activating the plugin, open the Common Settings page of the Calendar. The Common Settings page allows you to set holidays, regular holidays, and periods and times when appointments can be made.
プラグインを有効化したらカレンダーの共通設定ページを開きます。共通設定画面では、休日や定休日、予約可能な期間や時間帯を設定することができます。
The new submission page of the Calendar allows for day and time status management for each event.
カレンダーの新規投稿ページでは、イベントごとに日にち・時間帯のステータス管理が可能です。
Once the shortcode is issued on the above page, insert it into a form submission containing inputs, such as Contact Form 7. Refer to “Shortcode Settings” below for the attributes of the shortcode, and only the calendar for viewing will be displayed on article pages without inputs. In such cases, do not enter any attribute values other than id.
上記ページでショートコードが発行されたら、Contact Form 7 などのinputの含まれたフォーム投稿に挿入します。ショートコードの各属性は下記の「Shortcode Settings」を参照してください。inputのない記事ページなどでは閲覧用のカレンダーのみが表示されます。その場合、id以外の属性値は記述しないでください。
The front screen displays the registered calendar, and selecting a day and time is reflected in the input.
フロント画面では登録したカレンダーを表示させ、日にち・時間を選択するとinputに反映されます。

Shortcode Settings
[multi-day-booking-calendar id='' start-name='' end-name='' start-time-name='' end-time-name='' mode='static']

id
Submission ID of registered calendar. Required.
start-name
The name attribute of the input tag for the start date.
start-time-name
The name attribute of the input tag for the start time.
end-name
The name attribute of the input tag for the end date.
end-time-name
The name attribute of the input tag for the end time.
mode
static : Embed the calendar in the page. default.
inline : A calendar dialog box appears when you click on the input tag.

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;
}

延伸相關外掛

文章
Filter
Mastodon