Wordpress 联系表 7 显示禁用星期几

Posted

技术标签:

【中文标题】Wordpress 联系表 7 显示禁用星期几【英文标题】:Wordpress Contact Form 7 Show Disable Days of the Week 【发布时间】:2021-04-17 21:22:42 【问题描述】:

我正在尝试在 CF7 版本 5.3.2 中获得一个日期选择器,它将不允许选择周末。

我已将此 javascript 添加到我的页脚。

jQuery(function ($) 
    $("#appt-date").datepicker(
    beforeShowDay: function(date) 
        var day = date.getDay();
        return [(day != 0 && day != 6)];
    
    );
        
);

当我添加这个时,我的日历下会出现第二个日历,周末会被正确禁用,如下图所示。但是,我需要主日历来禁用周末。这个第二个日历来自哪里我如何在我的主日历上正确禁用周末?

【问题讨论】:

使用 [text appt-date] 而不是日期字段。 【参考方案1】:

如果您使用的是 jQuery UI 日期选择器,请不要在联系表单 7 中使用 [date] 字段选项。使用 date 类型将启用基于浏览器的日期选择器。

使用

[text appt-date]

相反。

【讨论】:

【参考方案2】:

不要打扰。如果您像我和无数其他人一样,您已经发现没有简单的答案可以通过日期/日历字段使用 ContactForm7 按名称或月份中的日期排除日期。一个简单的替代方法是使用条件字段和选择列表。这是一个使用数字作为月份的天数的方法。我确信可以修改此方法以适应大多数类似的目的。

例子:

<label>Arrival Date*
[select* ARRIVE-MONTH "JAN" "FEB" "MAR" "APR" "MAY" "JUN" "JUL" "AUG" "SEP" "OCT" "NOV" "DEC"]  </label>

[group ARR-TWENTYEIGHT]
[select* ARRTWENTYEIGHT include_blank "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "20" "21" "22" "23" "24" "25" "26" "27" "28"]
[/group]

[group ARR-THIRTY]
[select* ARRTHIRTY include_blank "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "30"]
[/group]

[group ARR-THIRTYONE]
[select* ARRTHIRTYONE include_blank "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "30" "31"]
[/group]

[group ARR-HOLIDAY-DEC]
[select* ARRHOLIDAY-DEC include_blank "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" "13" "14" "15" "16"]
[/group]

[group ARR-HOLIDAY-JAN]
[select* ARRHOLIDAY-JAN include_blank "4" "5" "6" "7" "8" "9" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "30" "31"]
[/group]

条件字段(文本模式)

show [ARR-HOLIDAY-JAN] if [ARRIVE-MONTH] equals "JAN"
show [ARR-TWENTYEIGHT] if [ARRIVE-MONTH] equals "FEB"
show [ARR-THIRTYONE] if [ARRIVE-MONTH] equals "MAR"
show [ARR-THIRTYONE] if [ARRIVE-MONTH] equals "APR"
show [ARR-THIRTYONE] if [ARRIVE-MONTH] equals "MAY"
show [ARR-THIRTY] if [ARRIVE-MONTH] equals "JUN"
show [ARR-THIRTYONE] if [ARRIVE-MONTH] equals "JUL"
show [ARR-THIRTYONE] if [ARRIVE-MONTH] equals "AUG"
show [ARR-THIRTY] if [ARRIVE-MONTH] equals "SEP"
show [ARR-THIRTYONE] if [ARRIVE-MONTH] equals "OCT"
show [ARR-THIRTY] if [ARRIVE-MONTH] equals "NOV"
show [ARR-HOLIDAY-DEC] if [ARRIVE-MONTH] equals "DEC"

.. 以及您的电子邮件:

启用:从输出中排除带有空白邮件标签的行

消息正文:

Arrival: [ARRIVE-MONTH] 
DAY:
[ARRTWENTYEIGHT]
[ARRTHIRTY]
[ARRTHIRTYONE]
[ARRHOLIDAY-DEC]
[ARRHOLIDAY-JAN]

【讨论】:

以上是关于Wordpress 联系表 7 显示禁用星期几的主要内容,如果未能解决你的问题,请参考以下文章

js 如何根据所选时间判断是星期几?

js显示当前日期时间和星期几

Win10系统右下角如何显示星期几

Win10系统右下角如何显示星期几

java代码问题。老师让写段代码输入字符显示星期几。代码如下:

JS调用今天星期几实际数字请问是怎么搞的