custom wordpress plugin code

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
drumguy
New php-forum User
New php-forum User
Posts: 2
Joined: Wed May 23, 2018 10:54 am

Wed May 23, 2018 11:00 am

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

<script>

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
});
});
</script>
User avatar
hyper
php-forum GURU
php-forum GURU
Posts: 1222
Joined: Mon Feb 22, 2016 5:52 pm

Wed May 23, 2018 3:17 pm

It looks to be JQuery script which is why you got an error trying to parse it as PHP.

What did the instructions that came with the script tell you to do?
drumguy
New php-forum User
New php-forum User
Posts: 2
Joined: Wed May 23, 2018 10:54 am

Wed May 23, 2018 7:27 pm

Unfortunately, there were no instructions. I guess there is an assumption that I would/should know what to do with it. Here's where I got it from: http://www.spiceforms.com/blog/how-to-d ... ort-guide/

If it's JQuery, how do I go about implementing it? I just want Sundays to be unselectable. I've noticed that when setting the parameters for the plugin, there is a place for 'Code snipets'. I think it's for short code though.
I sense this is an easy fix, but I have no clue how to do it.
chorn
php-forum GURU
php-forum GURU
Posts: 688
Joined: Fri Apr 01, 2016 2:18 am

Wed May 23, 2018 10:52 pm

There are alreadysolutions for it, just search for "jquery datepicker disable sundays".
AmieDonnelly
New php-forum User
New php-forum User
Posts: 1
Joined: Fri May 28, 2021 5:42 am

Fri May 28, 2021 5:47 am

I also have a WordPress site and the booking form on my website became a headache for me. After that, I installed the gravity forms booking plugin and now with the help of this plugin, the booking section is working so accurately. I also suggest you you get this plugin, I will guarantee you you will love this plugin.
Post Reply