如何在wordpress中实现jquery? [英] How do I implement jquery in wordpress?
问题描述
您好我有一个wordpress网站,需要一个简单的预约部分。一切正常,但我想从日历中排除星期日。这是预订的页面:http://fluffypuppies.ca/1317-2/该人不应该选择星期日,它应该是灰色的。
我找到了这段代码,但我不知道应该去哪里。我尝试将它放在functions.php中,但我收到一条错误消息。它应该去哪里才能使其正常工作?或者,如果你有更好的建议,我会很感激。
谢谢
函数DisableSunday(日期){
var day = date.getDay();
//如果日== 0然后是星期天
if(day == 0){
return [false];
}否则{
返回[true];
} < br $>
}
$(函数(){
$(# datepicker)。datepicker({
beforeShowDay:DisableSunday
});
});
我尝试了什么:
我试过删除脚本标签,也将它直接放在我的wordpress主题中的模块中。我也尝试删除第一个$符号并用jQuery替换它(函数($)。我知道我很接近,但我错过了什么?!
Hi I have a wordpress site that needs a simple appointment booking section. Everything is working fine but I want to exclude Sundays from the calendar. This is the page with the booking: http://fluffypuppies.ca/1317-2/ The person should not be able to select Sundays and it should be greyed out.
I found this code but I don’t know where it should go. I tried placing it in the functions.php but I get an error message. Where should it go in order to make it work correctly? Or if you have a better suggestion I’d appreciate it.
Thanks
function DisableSunday(date) {
var day = date.getDay();
// If day == 0 then it is Sunday
if (day == 0) {
return [false] ;
} else {
return [true] ;
}
}
$(function() {
$( "#datepicker" ).datepicker({
beforeShowDay: DisableSunday
});
});
What I have tried:
I have tried removing the script tag, also placing it directly in the module within my wordpress theme. I have also tried removing the first $ sign and replacing it with jQuery(function($). I know I'm close, but what am I missing?!
推荐答案
(function(){
(function() {
(#datepicker)。datepicker({
beforeShowDay:DisableSunday
});
});
我尝试了什么:
我试过删除脚本标签,也把它直接放在我的wordpress主题中的模块中。我也尝试删除第一个
( "#datepicker" ).datepicker({
beforeShowDay: DisableSunday
});
});
What I have tried:
I have tried removing the script tag, also placing it directly in the module within my wordpress theme. I have also tried removing the first
签名并用jQuery替换它(函数(
sign and replacing it with jQuery(function(
这篇关于如何在wordpress中实现jquery?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!