実際私も参考ページを元に色々試したものです。
結論から申しますと、手順どおりに行うことで実現可能です。
手順として
①プラグイン「Insert Headers and Footers」をインストールする
②Insert Headers and Footersの「Scripts in Header」部分に以下を入力
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1/i18n/jquery.ui.datepicker-ja.min.js"></script>
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.css">
<script>
$(function() {
$.datepicker.setDefaults($.datepicker.regional["ja"]);
$("#fuka").datepicker( {//#以下はContact Form 7のフォームのIDを指定
autoSize: true,//テキストボックスの幅を自動設定
dateFormat: 'yy/mm/dd',
minDate: '$date',//上記で判定した翌日・翌々日の日付を指定
beforeShowDay : function(date) {//以下、休業日設定をする日付を記載
var dateFormat = 'yy/mm/dd';
var disableDates = [
"2019/01/14","2019/01/21","2019/01/28",
"2019/02/04","2019/02/11","2019/02/18","2019/02/25",
"2019/03/04","2019/03/11","2019/03/18","2019/03/25",
"2019/04/01","2019/04/08","2019/04/15","2019/04/22","2019/04/29",
"2019/05/06","2019/05/13","2019/05/20","2019/05/27",
"2019/06/03","2019/06/10","2019/06/17","2019/06/24",
"2019/07/01","2019/07/08","2019/07/15","2019/07/22","2019/07/29",
"2019/08/05","2019/08/12","2019/08/19","2019/08/26",
"2019/09/02","2019/09/09","2019/09/16","2019/09/23","2019/09/30",
"2019/10/07","2019/10/14","2019/10/21","2019/10/28",
"2019/11/04","2019/11/11","2019/11/18","2019/11/25",
"2019/12/02","2019/12/09","2019/12/16","2019/12/23",
"2019/12/29","2019/12/30","2019/12/31","2020/01/01","2020/01/02","2020/01/03","2020/01/04"
];
var disableDate = $.datepicker.formatDate(dateFormat, date);
return [( disableDates.indexOf(disableDate) == -1 ), "", ""];
}
});
});
</script>
私の場合は毎週月曜日を選択不可及び年末年始は選択不可に設定しました。
③コンタクトフォームで、日付欄を入力。
[date* g-date id:fuka placeholder "日付を選択して下さい"]
上記部分でオプションはそれぞれ入力してください。
例)date-format min-date max-date readonly等。
以上で選択不可になるかと思います。
色々調べた結果、Contact Form 7 Datepickerだけではカスタマイズの幅が狭く、結果jQuery ui Datepickerを単独で導入させることで実現可能との事でした。
以上、ご参考までに。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/06/11 09:38
退会済みユーザー
2018/06/11 11:41