Forum Replies Created
- AuthorPosts
pik70
ParticipantHi Ally,
I put your code and it’s work.
Thanks 🙂
pik70
ParticipantHi,
I have two forms, in the first form I blocked the thursdays with your code “Blocking entire days”, and it’s work. I need block the wednesday in the second form, when I put again the code in the functions.php, just change the unique ID and the days, doesn’t work and my web show me a error.
This is my code:
//FIRST BLOCK//
function mytheme_datepicker_block_days($options, $dpMinYear, $dpMaxYear, $element)
{
return “{
beforeShowDay: function (date) {
var day = date.getDay();
if (day == 0 || day == 1 || day == 2 || day == 3 || day == 5 || day == 6) {
// Esta fecha no opera este tour.
return [false, ”];
} else {
return [true, ”];
}
}
}”;
}
add_filter(‘iphorm_datepicker_options_iphorm_206_64’, ‘mytheme_datepicker_block_days’, 10, 4);function mytheme_block_days($valid, $value, $element)
{
if ($valid) {
$time = strtotime(“{$value[‘year’]}-{$value[‘month’]}-{$value[‘day’]}”);
$day = date(‘w’, $time);if (day == 0 || day == 1 || day == 2 || day == 3 || day == 5 || day == 6) {
$element->addError(‘Este tour tiene salidas los días JUEVES’);
$valid = false;
}
}return $valid;
}
add_filter(‘iphorm_element_valid_iphorm_206_64’, ‘mytheme_block_days’, 10, 3);//SECOND BLOCK//
function mytheme_datepicker_block_days($options, $dpMinYear, $dpMaxYear, $element)
{
return “{
beforeShowDay: function (date) {
var day = date.getDay();
if (day == 0 || day == 1 || day == 2 || day == 4 || day == 5 || day == 6) {
// Esta fecha no opera este tour.
return [false, ”];
} else {
return [true, ”];
}
}
}”;
}
add_filter(‘iphorm_datepicker_options_iphorm_207_64’, ‘mytheme_datepicker_block_days’, 10, 4);function mytheme_block_days($valid, $value, $element)
{
if ($valid) {
$time = strtotime(“{$value[‘year’]}-{$value[‘month’]}-{$value[‘day’]}”);
$day = date(‘w’, $time);if (day == 0 || day == 1 || day == 2 || day ==43 || day == 5 || day == 6) {
$element->addError(‘Este tour tiene salidas los días MIERCOLES’);
$valid = false;
}
}return $valid;
}
add_filter(‘iphorm_element_valid_iphorm_207_64’, ‘mytheme_block_days’, 10, 3);Regards,
pik70
ParticipantHi Ally,
Thanks, it’s work 🙂
Regards,
- AuthorPosts