WordPressのカレンダー、休診などの定義を変更する場合

WordPressのカレンダー、休診などの定義を変更する場合

既に設置済みの診療カレンダーで、使わなくなった定義を、他の設定に変えたい時の対処方法です。

【依頼例】午後休診を選べないので、午後休診の入力欄を追加したい。
【変更内容】臨時診療の欄を使用していなかったので、臨時診療を午後休診に変更した。

対象サイト:http://ishii-4159.com/

実際の作業内容は以下です。

変更箇所①

管理画面の表示名を変えます。

管理画面:外観>ウィジット>診療カレンダ-

コード
Calendar/wp-content/plugins/business-calendar/business-calendar.php

<p>診療時間が変更になる日:<br />
<textarea class=”widefat” rows=”5″ id=”<?php echo $this->get_field_id(‘change’); ?>” name=”<?php echo $this->get_field_name(‘change’); ?>”><?php echo $change; ?></textarea></p>

<p>臨時診療日:<br />
<textarea class=”widefat” rows=”5″ id=”<?php echo $this->get_field_id(‘exclude’); ?>” name=”<?php echo $this->get_field_name(‘exclude’); ?>”><?php echo $exclude; ?></textarea></p>

<p>臨時休診日(祝日等):<br />
<textarea class=”widefat” rows=”5″ id=”<?php echo $this->get_field_id(‘include’); ?>” name=”<?php echo $this->get_field_name(‘include’); ?>”><?php echo $include; ?></textarea></p>

↓↓↓↓↓↓↓↓↓↓↓↓↓↓

<p>診療時間が変更になる日:<br />
<textarea class=”widefat” rows=”5″ id=”<?php echo $this->get_field_id(‘change’); ?>” name=”<?php echo $this->get_field_name(‘change’); ?>”><?php echo $change; ?></textarea></p>

<p>午後休診日:<br />
<textarea class=”widefat” rows=”5″ id=”<?php echo $this->get_field_id(‘exclude’); ?>” name=”<?php echo $this->get_field_name(‘exclude’); ?>”><?php echo $exclude; ?></textarea></p>

<p>臨時休診日(祝日等):<br />
<textarea class=”widefat” rows=”5″ id=”<?php echo $this->get_field_id(‘include’); ?>” name=”<?php echo $this->get_field_name(‘include’); ?>”><?php echo $include; ?></textarea></p>

 

変更箇所②

カレンダーにあたるクラス名を変更します。

午後休診のクラスは”am”なので、amのクラスがあたるようにします。

コード
Calendar/wp-content/plugins/business-calendar/business-calendar.js

// 休日の確認
holiday = bas_holiday[week][myday];
if(chg_holiday[arr] != undefined) {
if(jQuery.inArray(i+””, chg_holiday[arr]) > -1) holiday = “change”;
}
if(exc_holiday[arr] != undefined) {
if(jQuery.inArray(i+””, exc_holiday[arr]) > -1) holiday = “”;
}
if(inc_holiday[arr] != undefined) {
if(jQuery.inArray(i+””, inc_holiday[arr]) > -1) holiday = “all”;
}

↓↓↓↓↓↓↓↓↓↓↓↓↓

// 休日の確認
holiday = bas_holiday[week][myday];
if(chg_holiday[arr] != undefined) {
if(jQuery.inArray(i+””, chg_holiday[arr]) > -1)holiday = “change”;
}
if(exc_holiday[arr] != undefined) {
if(jQuery.inArray(i+””, exc_holiday[arr]) > -1) holiday = “am”;
}
if(inc_holiday[arr] != undefined) {
if(jQuery.inArray(i+””, inc_holiday[arr]) > -1) holiday = “all”;
}

 

以上です。

新たに追加する場合はもっと変更箇所が多いので、既存のものを変更することで対応可能であればそっちを優先する方がミスが少ないと思います。